changeset 17676:3be3d8523223 draft

(svn r22451) -Codechange: Test for bridges and tunnels during the first pass only while terraforming (HackaLittleBit)
author alberth <alberth@openttd.org>
date Sat, 14 May 2011 09:26:16 +0000
parents 872a115516d2
children a2fc35a0b414
files src/terraform_cmd.cpp
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/terraform_cmd.cpp
+++ b/src/terraform_cmd.cpp
@@ -308,16 +308,18 @@
 			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? */