mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +02:00
Fix possible crash on hovering over inaccessible hexes on other side of
the battlefield when war machine is making turn
This commit is contained in:
@ -392,8 +392,8 @@ BattleHexArray BattleFieldController::getHighlightedHexesForMovementTarget()
|
||||
|
||||
if (stack->doubleWide())
|
||||
{
|
||||
const bool canMoveHeadHere = availableHexes.contains(hoveredHex);
|
||||
const bool canMoveTailHere = availableHexes.contains(hoveredHex.cloneInDirection(stack->destShiftDir()));
|
||||
const bool canMoveHeadHere = hoveredHex.isAvailable() && availableHexes.contains(hoveredHex);
|
||||
const bool canMoveTailHere = hoveredHex.isAvailable() && availableHexes.contains(hoveredHex.cloneInDirection(stack->destShiftDir()));
|
||||
const bool backwardsMove = stack->unitSide() == BattleSide::ATTACKER ?
|
||||
hoveredHex.getX() < stack->getPosition().getX():
|
||||
hoveredHex.getX() > stack->getPosition().getX();
|
||||
@ -822,7 +822,7 @@ bool BattleFieldController::isTileAttackable(const BattleHex & number) const
|
||||
|
||||
for (auto & elem : occupiableHexes)
|
||||
{
|
||||
if (BattleHex::mutualPosition(elem, number) != -1 || elem == number)
|
||||
if (BattleHex::mutualPosition(elem, number) != BattleHex::EDir::NONE || elem == number)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user