瀏覽代碼

BattleAI: Fix endless loop

Fixed an issue where the part of a 2-tile-unit that is outside of the map was considered a target and caused an endless-loop in the pathfinding being unable to get there.
Xilmi 1 年之前
父節點
當前提交
6bd442e6f1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      AI/BattleAI/AttackPossibility.cpp

+ 1 - 1
AI/BattleAI/AttackPossibility.cpp

@@ -245,7 +245,7 @@ AttackPossibility AttackPossibility::evaluate(
 
 	std::vector<BattleHex> defenderHex;
 	if(attackInfo.shooting)
-		defenderHex = defender->getHexes();
+		defenderHex.push_back(defender->getPosition());
 	else
 		defenderHex = CStack::meleeAttackHexes(attacker, defender, hex);