소스 검색

Fix possible crash on trying to move to invalid battlefield hexes

Ivan Savenko 1 년 전
부모
커밋
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);
 	}