Bugfix for JaggZilla Bug #625

There was a check missing if the item we look at is really an ammo item. Other item classes can have class indexes too...

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6537 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2013-10-27 15:33:30 +00:00
parent 954b2bffc0
commit decc986649
+2 -1
View File
@@ -2245,7 +2245,8 @@ void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup ){
for(UINT16 i = 0; i < pInventoryPoolList.size(); i++)
{ // TODO: index ammo crates in sector, don't loop over entire inventory for each mag/gun
if( Magazine[ Item[pInventoryPoolList[i].object.usItem].ubClassIndex ].ubMagType >= AMMO_BOX // item is ammo box/crate
if( Item[ pInventoryPoolList[i].object.usItem ].usItemClass == IC_AMMO // really looking at ammo? Class indexes also exist for other item classes!
&& Magazine[ Item[pInventoryPoolList[i].object.usItem].ubClassIndex ].ubMagType >= AMMO_BOX // item is ammo box/crate
&& Magazine[ Item[pInventoryPoolList[i].object.usItem].ubClassIndex ].ubAmmoType // same ammo type
== Magazine[ Item[loop].ubClassIndex ].ubAmmoType // as the mag we found?
&& Magazine[ Item[pInventoryPoolList[i].object.usItem].ubClassIndex ].ubCalibre // same calibre