1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +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 1ccfa6072f
commit fe115c6917

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