Fix: enemy artillery shells are wrongly attributed to have been fired from Merc 0

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7818 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-04-19 09:21:33 +00:00
parent fa0236d45b
commit 17fba036b0
+14 -11
View File
@@ -4074,18 +4074,21 @@ void HandleExplosionQueue( void )
if ( (*pObj)[0]->data.ubWireNetworkFlag & ARTILLERY_STRIKE_COUNT_2 ) cnt += 2;
if ( (*pObj)[0]->data.ubWireNetworkFlag & ARTILLERY_STRIKE_COUNT_4 ) cnt += 4;
// determine gridno to attack - smoke signal required. Otherwise, it is assumed the radio operator ordered the bombing of his OWN position
// if we cannot even find a radio operator, all bets are off - target a random gridno
// the usual +/- 2 shenanigans
UINT16 usOwner = max( 0, (*pObj)[0]->data.misc.ubBombOwner - 2 );
INT32 sTargetGridNo = -1;
if ( GetRandomSignalSmokeGridNo( &sTargetGridNo ) || GetRadioOperatorSignal( usOwner, &sTargetGridNo ) || (sTargetGridNo = RandomGridNo( )) )
{
for ( UINT8 i = 0; i < cnt; ++i)
ArtilleryStrike( pObj->usItem, usOwner, sGridNo, sTargetGridNo );
}
// determine gridno to attack - smoke signal required. Otherwise, it is assumed the radio operator ordered the bombing of his OWN position
// if we cannot even find a radio operator, all bets are off - target a random gridno
// the usual +/- 2 shenanigans
UINT16 usOwner = NOBODY;
if ( (*pObj)[0]->data.misc.ubBombOwner > 1 )
usOwner = (*pObj)[0]->data.misc.ubBombOwner - 2;
// not needed anymore
INT32 sTargetGridNo = NOWHERE;
if ( GetRandomSignalSmokeGridNo( &sTargetGridNo ) || GetRadioOperatorSignal( usOwner, &sTargetGridNo ) || (sTargetGridNo = RandomGridNo( )) )
{
for ( UINT8 i = 0; i < cnt; ++i)
ArtilleryStrike( pObj->usItem, usOwner, sGridNo, sTargetGridNo );
}
// not needed anymore
RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel );
}
else