Fix: Militia does not equip multi-shot launchers if there are less than 3 shots in the sector.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7735 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-02-13 20:47:54 +00:00
parent b3b3fe0580
commit 89b9a69b9b
+13 -3
View File
@@ -4471,15 +4471,25 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI
// we investigate the launchers we found, and their ammo.
if ( gGameExternalOptions.fMilitiaUseSectorInventory_Launcher && !si[SI_LAUNCHER].done )
{
// remember the best ammo count we found
UINT16 bestammocount = 0;
LauncherHelpMap::iterator itend = launcherhelpmap.end();
for (LauncherHelpMap::iterator it = launcherhelpmap.begin(); it != itend; ++it)
{
// we pick the first launcher that needs no ammo or has enough ammo
if ( !(*it).second.fNeedsAmmo || (*it).second.ammocount > 3 )
// if a launcher does not need ammo, take that one
if ( !(*it).second.fNeedsAmmo )
{
usLauncherItem = (*it).first;
usLauncherAmmoLeftToTake = 0;
break;
}
// otherwise pick the one with the highest ammo count (but not higher than 3, we don't want to hoard all the ammo)
else if ( (*it).second.ammocount > bestammocount )
{
usLauncherItem = (*it).first;
usLauncherAmmoLeftToTake = (*it).second.ammocount ? 3 : 0;
break;
bestammocount = usLauncherAmmoLeftToTake;
}
}
}