From dec3f9afd9d18423563f1d6d76572b04e601b10e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Sat, 29 Sep 2012 20:25:54 +0000 Subject: [PATCH] #1083 should be fixed. To be released as dev build 0.89d. --- lib/CBattleCallback.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/CBattleCallback.cpp b/lib/CBattleCallback.cpp index ef92cf2ad..fe4ce6f90 100644 --- a/lib/CBattleCallback.cpp +++ b/lib/CBattleCallback.cpp @@ -1054,6 +1054,12 @@ AccessibilityInfo CBattleInfoCallback::getAccesibility() const ret[BattleHex(0, y)] = EAccessibility::SIDE_COLUMN; } + //gate -> should be before stacks + if(battleGetSiegeLevel() > 0 && battleGetWallState(EWallParts::GATE) < 3) //gate is not destroyed + { + ret[95] = ret[96] = EAccessibility::GATE; //block gate's hexes + } + //tiles occupied by standing stacks BOOST_FOREACH(auto stack, battleAliveStacks()) { @@ -1086,12 +1092,6 @@ AccessibilityInfo CBattleInfoCallback::getAccesibility() const if(battleGetWallState(lockedIfNotDestroyed[b].first) < 3) ret[lockedIfNotDestroyed[b].second] = EAccessibility::DESTRUCTIBLE_WALL; } - - //gate - if(battleGetWallState(7) < 3) //if it attacker's unit and gate is not destroyed - { - ret[95] = ret[96] = EAccessibility::GATE; //block gate's hexes - } } return ret; @@ -2196,9 +2196,12 @@ bool AccessibilityInfo::accessible(BattleHex tile, bool doubleWide, bool attacke { // All hexes that stack would cover if standing on tile have to be accessible. BOOST_FOREACH(auto hex, CStack::getHexes(tile, doubleWide, attackerOwned)) - if(!hex.isValid() || at(hex) != EAccessibility::ACCESSIBLE) + { + const bool markedAccessible = at(hex) == EAccessibility::ACCESSIBLE; + const bool gateAccessible = (at(hex) == EAccessibility::GATE) && !attackerOwned; //defender can always step on gate + if(!hex.isValid() || (!markedAccessible && !gateAccessible)) return false; - + } return true; }