From 5b71be40453ab3bc58055f507154fd4164fd0922 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Fri, 31 Jul 2020 12:02:45 +0000 Subject: [PATCH] CalcCoverValue: improved friendly fire check. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8874 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- TacticalAI/FindLocations.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index b35caf497..4e628283c 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -401,14 +401,14 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT32 sMyGridNo, INT32 iMyThreat, INT32 i // let's not assume anything about the stance the enemy might take, so take an average // value... no cover give a higher value than partial cover bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->pathing.bLevel, iMyAPsLeft ); - gUnderFire.Disable(); + gUnderFire.Disable(); + ubFriendlyFireChance = gUnderFire.Chance(pMe->bTeam, pMe->bSide, TRUE); // sevenfm: penalize position if friendly fire chance is high - if (gGameExternalOptions.fAIBetterCover && ubFriendlyFireChance > MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE) + if (gGameExternalOptions.fAIBetterCover && ubFriendlyFireChance > MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE) { - ubFriendlyFireChance = gUnderFire.Chance(pMe->bTeam, pMe->bSide, TRUE); bMyCTGT = 1; - } + } // since NPCs are too dumb to shoot "blind", ie. at opponents that they // themselves can't see (mercs can, using another as a spotter!), if the