From 50f45bc2d9a9d1c7bcdee44344a40807f64ea11e Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Sun, 6 Dec 2020 13:17:42 +0000 Subject: [PATCH] Improved r8460 fix: also check for incorrect ammo item. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8917 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Items.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index cd6b1bc0..b3dba983 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -3424,7 +3424,8 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo CreateAmmo((*pGun)[subObject]->data.gun.usGunAmmoItem, &gTempObject, (*pGun)[subObject]->data.gun.ubGunShotsLeft); // Flugente: safety check: if object is broken, wipe it - if ( gTempObject.usItem == NOTHING ) + // sevenfm: also check for incorrect ammo item + if (gTempObject.usItem == NOTHING || !(Item[gTempObject.usItem].usItemClass & IC_AMMO)) gTempObject.initialize( ); if (fSameMagazineSize) @@ -3533,7 +3534,7 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo } } - //CHRIS: This should reset the number of bullest moved to what we can actually afford when loading loose rounds + //CHRIS: This should reset the number of bullets moved to what we can actually afford when loading loose rounds if(Weapon[pGun->usItem].swapClips == 0 && (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) { if(fEnoughAPs)