瀏覽代碼

* Fixed battle crash (if they're double wide creatures)

beegee1 13 年之前
父節點
當前提交
2a50d8d464
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. 9 5
      lib/CBattleCallback.cpp

+ 9 - 5
lib/CBattleCallback.cpp

@@ -2200,10 +2200,14 @@ 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))
 	{
-		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;
+        // If the hex is out of range then the tile isn't accessible
+        if(!hex.isValid())
+            return false;
+        // If we're no defender which step on gate and the hex isn't accessible, then the tile
+        // isn't accessible
+        else if(at(hex) != EAccessibility::ACCESSIBLE &&
+                !(at(hex) == EAccessibility::GATE && !attackerOwned))
+            return false;
 	}
 	return true;
 }
@@ -2345,4 +2349,4 @@ BattleAttackInfo BattleAttackInfo::reverse() const
 	ret.luckyHit = ret.ballistaDoubleDamage = ret.deathBlow = false;
 
 	return ret;
-}
+}