1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fix possible crash on trying to move to invalid battlefield hexes

This commit is contained in:
Ivan Savenko 2024-07-20 18:28:13 +00:00
parent 3c611ffa5b
commit 1c522c49b6

View File

@ -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);
}