Browse Source

Fix potential concurrent access

Ivan Savenko 9 months ago
parent
commit
3d1bf03a25
1 changed files with 3 additions and 1 deletions
  1. 3 1
      AI/BattleAI/BattleEvaluator.cpp

+ 3 - 1
AI/BattleAI/BattleEvaluator.cpp

@@ -756,7 +756,9 @@ bool BattleEvaluator::attemptCastingSpell(const CStack * activeStack)
 
 					auto updatedAttack = AttackPossibility::evaluate(updatedBai, cachedAttack.ap->from, innerCache, state);
 
-					stackActionScore = scoreEvaluator.evaluateExchange(updatedAttack, cachedAttack.turn, *targets, innerCache, state);
+					BattleExchangeEvaluator innerEvaluator(scoreEvaluator);
+
+					stackActionScore = innerEvaluator.evaluateExchange(updatedAttack, cachedAttack.turn, *targets, innerCache, state);
 				}
 				for(const auto & unit : allUnits)
 				{