clear_cmd.c
changeset 3933 a5f08e17f4a0
parent 3671 6d3a34989d05
child 3977 edb5b94e2094
--- a/clear_cmd.c	Thu Jun 01 22:20:40 2006 +0000
+++ b/clear_cmd.c	Fri Jun 02 13:05:41 2006 +0000
@@ -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 @@
 				} 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 @@
 	}
 
 	DrawClearLandFence(ti);
+	DrawBridgeMiddle(ti);
 }
 
 static uint GetSlopeZ_Clear(const TileInfo* ti)