summaryrefslogtreecommitdiff
path: root/src/terraform_cmd.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-05-14 09:26:16 +0000
committeralberth <alberth@openttd.org>2011-05-14 09:26:16 +0000
commita63b22991d4df2862009efc745dd2e7adb4e395d (patch)
tree570e4faeb638f702f8af7e412c0fd645557274ac /src/terraform_cmd.cpp
parent772fd8f6b5c67f556325b857223d18a887c040fc (diff)
downloadopenttd-a63b22991d4df2862009efc745dd2e7adb4e395d.tar.xz
(svn r22451) -Codechange: Test for bridges and tunnels during the first pass only while terraforming (HackaLittleBit)
Diffstat (limited to 'src/terraform_cmd.cpp')
-rw-r--r--src/terraform_cmd.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp
index 7ce117469..7937d082e 100644
--- a/src/terraform_cmd.cpp
+++ b/src/terraform_cmd.cpp
@@ -308,16 +308,18 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (z_E > z_min) tileh |= SLOPE_E;
if (z_N > z_min) tileh |= SLOPE_N;
- /* Check if bridge would take damage */
- if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
- GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) {
- _terraform_err_tile = tile; // highlight the tile under the bridge
- return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
- }
- /* Check if tunnel would take damage */
- if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
- _terraform_err_tile = tile; // highlight the tile above the tunnel
- return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
+ if (pass == 0) {
+ /* Check if bridge would take damage */
+ if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
+ GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) {
+ _terraform_err_tile = tile; // highlight the tile under the bridge
+ return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
+ }
+ /* Check if tunnel would take damage */
+ if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
+ _terraform_err_tile = tile; // highlight the tile above the tunnel
+ return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
+ }
}
/* Is the tile already cleared? */