Просмотр исходного кода

Fix possible crash on trying to move to invalid battlefield hexes

Ivan Savenko 1 год назад
Родитель
Сommit
fe115c6917
1 измененных файлов с 1 добавлено и 2 удалено
  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);
 	}