diff options
author | peter1138 <peter1138@openttd.org> | 2008-01-23 08:28:19 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-01-23 08:28:19 +0000 |
commit | ff0891426f9f067a376a369f45c94573a93d7679 (patch) | |
tree | dc557ba6f01486528a93aa4a6f7f99bf140533dd | |
parent | 983fdb8a4f811ad1bc7c596aaa3bda66857a4249 (diff) | |
download | openttd-ff0891426f9f067a376a369f45c94573a93d7679.tar.xz |
(svn r11955) -Fix (r11926): Prevent bridge and tunnel ends being placed on rivers.
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 52762f9f5..da5819b17 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -258,7 +258,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p /* retrieve landscape height and ensure it's on land */ tile_start = TileXY(x, y); tile_end = TileXY(sx, sy); - if (IsWaterTile(tile_start) || IsWaterTile(tile_end)) { + if (IsWaterTile(tile_start) || IsRiverTile(tile_start) || IsWaterTile(tile_end) || IsRiverTile(tile_end)) { return_cmd_error(STR_02A0_ENDS_OF_BRIDGE_MUST_BOTH); } @@ -484,6 +484,8 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 default: return_cmd_error(STR_500B_SITE_UNSUITABLE_FOR_TUNNEL); } + if (IsRiverTile(start_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); + ret = DoCommand(start_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); if (CmdFailed(ret)) return ret; @@ -536,6 +538,8 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32 /* if the command fails from here on we want the end tile to be highlighted */ _build_tunnel_endtile = end_tile; + if (IsRiverTile(end_tile)) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); + /* slope of end tile must be complementary to the slope of the start tile */ if (end_tileh != ComplementSlope(start_tileh)) { /* Check if there is a structure on the terraformed tile. Do not add the cost, that will be done by the terraforming */ |