Fix: antimateriel bullet damage to structures often isn't properly applied

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9080 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2021-06-13 17:23:55 +00:00
parent 680a8cb43a
commit ff3076203f
2 changed files with 18 additions and 15 deletions
+2 -1
View File
@@ -5633,7 +5633,8 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN
// Get Structure pointer and damage it!
if ( usStructureID != INVALID_STRUCTURE_ID )
{
pStructure = FindStructureByID( sGridNo, usStructureID );
// Flugente: if possible, take the gridno of the bullet. Otherwise we often get the issue that the calculated gridno is not the one where the structure is, leading to the structure being undamaged
pStructure = FindStructureByID( pBullet ? pBullet->sGridNo : sGridNo, usStructureID );
DamageStructure( pStructure, (UINT8)iImpact, STRUCTURE_DAMAGE_GUNFIRE, sGridNo, sXPos, sYPos, ubAttackerID, pBullet->usFlags & BULLET_FLAG_ANTIMATERIEL ? pBullet->iImpact - pBullet->iImpactReduction : 0 );
}