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
commitb618b75c9b189b13c296cff78d4f070c52fae035 (patch)
treed5df4e2831609eca45d7ea4558e09a600089ead2 /clear_cmd.c
parent7e6d84a34ec91e27c3c1653061f043b68cc29bac (diff)
downloadopenttd-b618b75c9b189b13c296cff78d4f070c52fae035.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)