From decc98664921f867f3304446cefde8e4340a02c0 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Sun, 27 Oct 2013 15:33:30 +0000 Subject: [PATCH] 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 --- Tactical/Interface Items.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index d4ab5b07..f338b804 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -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