Fix: militia equipment item fitness function still considered ammo even if MILITIA_USE_SECTOR_EQUIPMENT_AMMO was false, thus possibly ignored guns that had no ammo loaded

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6030 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-04-28 15:58:58 +00:00
parent 54ffaa2624
commit 7f467f4f80
+12 -9
View File
@@ -4027,7 +4027,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
UINT16 numcrates = 0;
BOOLEAN fNewMagCreated = FALSE;
OBJECTTYPE newAmmoObj;
BOOLEAN fSearchForAmmo = TRUE;
BOOLEAN fSearchForAmmo = TRUE;
UINT16 usLauncherItem = 0;
UINT8 usLauncherAmmoLeftToTake = 0;
UINT16 usSelectedGunBulletsNeeded = 0; // how many bullets do we want for our gun
@@ -4367,17 +4367,20 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
Calibre_BulletCountMap::iterator calibremap_it = calibrebulletountmap.find( calibre );
if ( calibremap_it != calibrebulletountmap.end() )
if ( fSearchForAmmo )
{
UINT32 bullets = GetTotalCalibreAmmo( &((*calibremap_it).second) );
// only evaluate of ammo is found!
if ( calibremap_it != calibrebulletountmap.end() )
{
UINT32 bullets = GetTotalCalibreAmmo( &((*calibremap_it).second) );
EvaluateObjForItem_WithAmmo( pWorldItem, pObj, uiCount, &si[SI_GUN], bullets );
EvaluateObjForItem_WithAmmo( pWorldItem, pObj, uiCount, &si[SI_GUN], bullets );
}
}
else
{
EvaluateObjForItem( pWorldItem, pObj, uiCount, &si[SI_GUN] );
}
// no ammo found... a gun without bullets is useless, ignore this thing
//else
//{
//EvaluateObjForItem_WithAmmo( pWorldItem, pObj, uiCount, &si[SI_GUN], 0 );
//}
}
else if ( Item[pWorldItem[ uiCount ].object.usItem].usItemClass & (IC_GRENADE|IC_BOMB) && !si[SI_LAUNCHER].done )
{