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:
parent
3c611ffa5b
commit
1c522c49b6
@ -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…
x
Reference in New Issue
Block a user