summaryrefslogtreecommitdiff
path: root/clear_cmd.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-06-02 13:05:41 +0000
committercelestar <celestar@openttd.org>2006-06-02 13:05:41 +0000
commit25a63ec7af6fadb2d33ef84f79597c14b10e7f39 (patch)
treed5df4e2831609eca45d7ea4558e09a600089ead2 /clear_cmd.c
parentd680fcec772d422b88ea4802add2e6195c6327a2 (diff)
downloadopenttd-25a63ec7af6fadb2d33ef84f79597c14b10e7f39.tar.xz
(svn r5070) Merged the bridge branch
-Feature: Bridges can now be placed above: Any railway track combination (excluding depots and waypoints) Any road combination (excluding depots) Clear tiles (duh), including fields Tunnel entrances Bridge heads Thanks to Tron for idea and implementation, KUDr for the yapf synchronization and many others for hours of testing There are still a number of visual problems remaining, especially when electric railways are on or under the bridge. DO NOT REPORT THOSE BUGS FOR THE TIME BEING please.
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)