summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-09-21 11:40:11 +0000
committerrubidium <rubidium@openttd.org>2014-09-21 11:40:11 +0000
commitce04c49e3d021451e8ad17e8a53e4e515f261209 (patch)
tree457f5c42490de310cb026744673048b0e7bb8781 /src/tunnelbridge_cmd.cpp
parentfedc1acd620f3fd364e6907ae760cc9cc9a057dc (diff)
downloadopenttd-ce04c49e3d021451e8ad17e8a53e4e515f261209.tar.xz
(svn r26882) -Feature: allow limiting the height of bridges (ic111)
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r--src/tunnelbridge_cmd.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 49b987d0a..d4b794633 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -391,6 +391,16 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
for (TileIndex tile = tile_start + delta; tile != tile_end; tile += delta) {
if (GetTileMaxZ(tile) > z_start) return_cmd_error(STR_ERROR_BRIDGE_TOO_LOW_FOR_TERRAIN);
+ if (z_start >= (GetTileZ(tile) + _settings_game.construction.max_bridge_height)) {
+ /*
+ * Disallow too high bridges.
+ * Properly rendering a map where very high bridges (might) exist is expensive.
+ * See http://www.tt-forums.net/viewtopic.php?f=33&t=40844&start=980#p1131762
+ * for a detailed discussion. z_start here is one heightlevel below the bridge level.
+ */
+ return_cmd_error(STR_ERROR_BRIDGE_TOO_HIGH_FOR_TERRAIN);
+ }
+
if (IsBridgeAbove(tile)) {
/* Disallow crossing bridges for the time being */
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);