(svn r22451) -Codechange: Test for bridges and tunnels during the first pass only while terraforming (HackaLittleBit)

This commit is contained in:
alberth 2011-05-14 09:26:16 +00:00
parent 772fd8f6b5
commit a63b22991d

View File

@ -308,16 +308,18 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (z_E > z_min) tileh |= SLOPE_E; if (z_E > z_min) tileh |= SLOPE_E;
if (z_N > z_min) tileh |= SLOPE_N; if (z_N > z_min) tileh |= SLOPE_N;
/* Check if bridge would take damage */ if (pass == 0) {
if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) && /* Check if bridge would take damage */
GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) { if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) &&
_terraform_err_tile = tile; // highlight the tile under the bridge GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) {
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); _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)) { /* Check if tunnel would take damage */
_terraform_err_tile = tile; // highlight the tile above the tunnel if (direction == -1 && IsTunnelInWay(tile, z_min * TILE_HEIGHT)) {
return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE); _terraform_err_tile = tile; // highlight the tile above the tunnel
return_cmd_error(STR_ERROR_EXCAVATION_WOULD_DAMAGE);
}
} }
/* Is the tile already cleared? */ /* Is the tile already cleared? */