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:
parent
1ccfa6072f
commit
fe115c6917
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user