- Fixed: SBARINFO used GetSpecies instead of GetClass to check weapon types.

- Added a few missing NULL pointer checks to SBARINFO code.


SVN r1344 (trunk)
This commit is contained in:
Christoph Oelckers 2009-01-01 16:46:05 +00:00
parent 6a321fd8f5
commit 7fde758e26
2 changed files with 9 additions and 7 deletions

View file

@ -1,4 +1,6 @@
January 1, 2009 (Changes by Graf Zahl)
- Fixed: SBARINFO used GetSpecies instead of GetClass to check weapon types.
- Added a few missing NULL pointer checks to SBARINFO code.
- Changed pickup sounds of local player to unpaused to resolve problems with
the time freezer and make them behave better.
- Fixed: When sounds are paused not all newly started sounds should actually

View file

@ -1256,30 +1256,30 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
const PClass *weapon2 = PClass::FindClass(cmd.string[1]);
if(weapon2 != NULL)
{
if((cmd.flags & SBARINFOEVENT_NOT) && (weapon1 != CPlayer->ReadyWeapon->GetSpecies() && weapon2 != CPlayer->ReadyWeapon->GetSpecies()))
if((cmd.flags & SBARINFOEVENT_NOT) && (weapon1 != CPlayer->ReadyWeapon->GetClass() && weapon2 != CPlayer->ReadyWeapon->GetClass()))
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
else if(!(cmd.flags & SBARINFOEVENT_NOT) && (weapon1 == CPlayer->ReadyWeapon->GetSpecies() || weapon2 == CPlayer->ReadyWeapon->GetSpecies()))
else if(!(cmd.flags & SBARINFOEVENT_NOT) && (weapon1 == CPlayer->ReadyWeapon->GetClass() || weapon2 == CPlayer->ReadyWeapon->GetClass()))
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
}
else
{
if(!(cmd.flags & SBARINFOEVENT_NOT) && weapon1 == CPlayer->ReadyWeapon->GetSpecies())
if(!(cmd.flags & SBARINFOEVENT_NOT) && weapon1 == CPlayer->ReadyWeapon->GetClass())
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
else if((cmd.flags & SBARINFOEVENT_NOT) && weapon1 != CPlayer->ReadyWeapon->GetSpecies())
else if((cmd.flags & SBARINFOEVENT_NOT) && weapon1 != CPlayer->ReadyWeapon->GetClass())
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
}
}
break;
case SBARINFO_USESAMMO:
if ((CPlayer->ReadyWeapon->AmmoType1 != NULL || CPlayer->ReadyWeapon->AmmoType2 != NULL) ^
if ((CPlayer->ReadyWeapon != NULL && (CPlayer->ReadyWeapon->AmmoType1 != NULL || CPlayer->ReadyWeapon->AmmoType2 != NULL)) ^
!!(cmd.flags & SBARINFOEVENT_NOT))
{
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
}
break;
case SBARINFO_USESSECONDARYAMMO:
if((CPlayer->ReadyWeapon->AmmoType2 != NULL && CPlayer->ReadyWeapon->AmmoType2 != CPlayer->ReadyWeapon->AmmoType1 && !(cmd.flags & SBARINFOEVENT_NOT)) ||
(CPlayer->ReadyWeapon->AmmoType2 == NULL && cmd.flags & SBARINFOEVENT_NOT))
if((CPlayer->ReadyWeapon != NULL && CPlayer->ReadyWeapon->AmmoType2 != NULL && CPlayer->ReadyWeapon->AmmoType2 != CPlayer->ReadyWeapon->AmmoType1 && !(cmd.flags & SBARINFOEVENT_NOT)) ||
((CPlayer->ReadyWeapon == NULL || CPlayer->ReadyWeapon->AmmoType2 == NULL) && cmd.flags & SBARINFOEVENT_NOT))
{
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
}