Fixed a potential crash when a merc dies.

Finally fixed CalcMaxTossRange so that it pulls the correct grenade launcher item instead of just the first one, thereby allowing more than one range value per set of launcher items that launch the same grenades.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5211 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2012-04-14 21:11:25 +00:00
parent b0b1ad9ef0
commit 6a24e04bbc
2 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -566,7 +566,7 @@ INT32 AddRottingCorpse( ROTTING_CORPSE_DEFINITION *pCorpseDef )
if ( pCorpse->pAniTile == NULL )
{
pCorpse->fActivated = FALSE;
return( -1 );
return( -1 );
}
// Set flag and index values
+17 -1
View File
@@ -10325,7 +10325,23 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed )
// if item's fired mechanically
// ATE: If we are sent in a LAUNCHABLE, get the LAUCNHER, and sub ONLY if we are armed...
usSubItem = GetLauncherFromLaunchable( usItem );
//MM: this only works if every launcher for a given launchable has the same range!!
//usSubItem = GetLauncherFromLaunchable( usItem );
//MM: So instead, let's look at the soldier's hand, and check his gun for an underbarrel GL
if ( fArmed )
{
OBJECTTYPE *pObj = NULL;
pObj = pSoldier->GetUsedWeapon( &pSoldier->inv[pSoldier->ubAttackingHand] );
if ( pObj != NULL )
{
if (Item[pObj->usItem].usItemClass == IC_LAUNCHER)
usSubItem = pObj->usItem;
else if (Item[pObj->usItem].usItemClass == IC_GUN)
{
usSubItem = GetAttachedGrenadeLauncher(pObj);
}
}
}
if ( fArmed && usSubItem != NOTHING )
{