(svn r26882) -Feature: allow limiting the height of bridges (ic111)

This commit is contained in:
rubidium
2014-09-21 11:40:11 +00:00
parent b50c649405
commit 647a3c8e5f
5 changed files with 31 additions and 4 deletions

View File

@@ -254,10 +254,20 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (pass == 0) {
/* Check if bridge would take damage */
if (direction == 1 && IsBridgeAbove(tile) &&
GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max) {
_terraform_err_tile = tile; // highlight the tile under the bridge
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
if (IsBridgeAbove(tile)) {
int bridge_height = GetBridgeHeight(GetSouthernBridgeEnd(tile));
/* Check if bridge would take damage. */
if (direction == 1 && bridge_height <= z_max) {
_terraform_err_tile = tile; // highlight the tile under the bridge
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
}
/* Is the bridge above not too high afterwards? */
if (direction == -1 && bridge_height > (z_min + _settings_game.construction.max_bridge_height)) {
_terraform_err_tile = tile;
return_cmd_error(STR_ERROR_BRIDGE_TOO_HIGH_AFTER_LOWER_LAND);
}
}
/* Check if tunnel would take damage */
if (direction == -1 && IsTunnelInWay(tile, z_min)) {