summaryrefslogtreecommitdiff
path: root/clear_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'clear_cmd.c')
-rw-r--r--clear_cmd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/clear_cmd.c b/clear_cmd.c
index 259146965..ca4cfa24b 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -11,6 +11,7 @@
#include "viewport.h"
#include "command.h"
#include "tunnel_map.h"
+#include "bridge_map.h"
#include "variables.h"
#include "table/sprites.h"
#include "unmovable_map.h"
@@ -259,6 +260,14 @@ int32 CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} else return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
}
+ if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) {
+ byte height = GetBridgeHeight(GetNorthernBridgeEnd(tile), GetBridgeAxis(tile));
+
+ height /= TILE_HEIGHT;
+
+ if (a >= height || b >= height || c >= height || d >= height) return_cmd_error(STR_5007_MUST_DEMOLISH_BRIDGE_FIRST);
+ }
+
if (direction == -1 && IsTunnelInWay(tile, min)) return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE);
_terraform_err_tile = 0;
@@ -501,6 +510,7 @@ static void DrawTile_Clear(TileInfo *ti)
}
DrawClearLandFence(ti);
+ DrawBridgeMiddle(ti);
}
static uint GetSlopeZ_Clear(const TileInfo* ti)