r9404: Prevent illegal array access

Using kill all enemies cheat via ALT + o caused reading MercPtrs from index 254 when its last element is at 253
This commit is contained in:
Asdow
2022-11-04 20:26:01 +02:00
parent e3c1c5e191
commit 95e9d83165
3 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -6603,12 +6603,18 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
if ( Item[usWeaponIndex].usItemClass & IC_GUN )
{
PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_GUNFIRE, ubAttackerID );
PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_GUNFIRE, this->ubID );
if (ubAttackerID != NOBODY)
{
PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_GUNFIRE, this->ubID );
}
}
else
{
PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_THROWING_KNIFE, ubAttackerID );
PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_THROWING_KNIFE, this->ubID );
if (ubAttackerID != NOBODY)
{
PossiblyStartEnemyTaunt(MercPtrs[ubAttackerID], TAUNT_HIT_THROWING_KNIFE, this->ubID);
}
}
}
if ( Item[usWeaponIndex].usItemClass & IC_BLADE )