From 4b0094902a8a2f793f4821cd10c15ba5fed57fe7 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sun, 18 Aug 2013 22:40:33 +0000 Subject: [PATCH] Forbid ammo with tracer effects to be used by AI on singleshot-only guns git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6293 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Items.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 409f03b6..6a54051d 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -7318,8 +7318,18 @@ UINT16 DefaultMagazine( UINT16 usItem ) Magazine[usLoop].ubMagSize == pWeapon->ubMagSize && AmmoTypes[ Magazine[usLoop].ubAmmoType ].standardIssue ) { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DefaultMagazine: found at index %d",usLoop)); - return(MagazineClassIndexToItemType(usLoop)); + // Flugente: forbid ammo with tracer effects to be used on singleshot-only guns (snipers wouldn't use ammo that marks their position, would they?) + if ( !pWeapon->ubShotsPerBurst && !pWeapon->bAutofireShotsPerFiveAP && AmmoTypes[ Magazine[usLoop].ubAmmoType ].tracerEffect ) + { + // don't use this one... + usLoop++; + continue; + } + else + { + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DefaultMagazine: found at index %d",usLoop)); + return(MagazineClassIndexToItemType(usLoop)); + } } usLoop++; @@ -7515,6 +7525,13 @@ UINT16 RandomMagazine( OBJECTTYPE * pGun, UINT8 ubPercentStandard, UINT8 maxCool { if ( gArmyItemChoices[bSoldierClass][ENEMYAMMOTYPES].bItemNo[i] == Magazine[usLoop].ubAmmoType ) { + // Flugente: forbid ammo with tracer effects to be used on singleshot-only guns (snipers wouldn't use ammo that marks their position, would they?) + if ( !pWeapon->ubShotsPerBurst && !pWeapon->bAutofireShotsPerFiveAP && AmmoTypes[ Magazine[usLoop].ubAmmoType ].tracerEffect ) + { + // don't use this one... + continue; + } + usPossibleMagIndex[usPossibleMagCnt++] = usLoop; break; }