Explorar o código

Fix possible crash on trying to move to invalid battlefield hexes

Ivan Savenko hai 1 ano
pai
achega
fe115c6917
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      AI/BattleAI/BattleEvaluator.cpp

+ 1 - 2
AI/BattleAI/BattleEvaluator.cpp

@@ -291,10 +291,9 @@ BattleAction BattleEvaluator::goTowardsNearest(const CStack * stack, std::vector
 		std::vector<BattleHex> copy = targetHexes;
 
 		for(auto hex : copy)
-		{
 			vstd::concatenate(targetHexes, hex.allNeighbouringTiles());
-		}
 
+		vstd::erase_if(targetHexes, [](const BattleHex & hex) {return !hex.isValid();});
 		vstd::removeDuplicates(targetHexes);
 	}