浏览代码

Fix movement over lowered drawbridge in Fortress

Ivan Savenko 2 年之前
父节点
当前提交
8fbeff2a02
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. 10 3
      lib/battle/CBattleInfoCallback.cpp

+ 10 - 3
lib/battle/CBattleInfoCallback.cpp

@@ -1004,12 +1004,19 @@ std::set<BattleHex> CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe
 
 	for(auto &oi : battleGetAllObstacles(whichSidePerspective))
 	{
-		if(battleIsObstacleVisibleForSide(*oi, whichSidePerspective))
+		if(!battleIsObstacleVisibleForSide(*oi, whichSidePerspective))
+			continue;
+
+		for(const auto & hex : oi->getStoppingTile())
 		{
-			range::copy(oi->getStoppingTile(), vstd::set_inserter(ret));
+			if(hex == ESiegeHex::GATE_BRIDGE && oi->obstacleType == CObstacleInstance::MOAT)
+			{
+				if(battleGetGateState() == EGateState::OPENED || battleGetGateState() == EGateState::DESTROYED)
+					continue; // this tile is disabled by drawbridge on top of it
+			}
+			ret.insert(hex);
 		}
 	}
-
 	return ret;
 }