1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00

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.
This commit is contained in:
Xilmi 2024-08-13 23:43:56 +02:00
parent b0933a1ff0
commit 6bd442e6f1

View File

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