diff options
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/settings_gui.cpp | 1 | ||||
-rw-r--r-- | src/table/settings.ini | 2 | ||||
-rw-r--r-- | src/terraform_cmd.cpp | 18 | ||||
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 10 |
5 files changed, 31 insertions, 4 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 8a8b013b8..e095edfe1 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1186,6 +1186,8 @@ STR_CONFIG_SETTING_INFLATION :Inflation: {STR STR_CONFIG_SETTING_INFLATION_HELPTEXT :Enable inflation in the economy, where costs are slightly faster rising than payments STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH :Maximum bridge length: {STRING2} STR_CONFIG_SETTING_MAX_BRIDGE_LENGTH_HELPTEXT :Maximum length for building bridges +STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT :Maximum bridge height: {STRING2} +STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT_HELPTEXT :Maximum height for building bridges STR_CONFIG_SETTING_MAX_TUNNEL_LENGTH :Maximum tunnel length: {STRING2} STR_CONFIG_SETTING_MAX_TUNNEL_LENGTH_HELPTEXT :Maximum length for building tunnels STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD :Manual primary industry construction method: {STRING2} @@ -4124,6 +4126,7 @@ STR_ERROR_EXCAVATION_WOULD_DAMAGE :{WHITE}Excavati STR_ERROR_ALREADY_AT_SEA_LEVEL :{WHITE}... already at sea level STR_ERROR_TOO_HIGH :{WHITE}... too high STR_ERROR_ALREADY_LEVELLED :{WHITE}... already flat +STR_ERROR_BRIDGE_TOO_HIGH_AFTER_LOWER_LAND :{WHITE}Afterwards the bridge above it would be too high. # Company related errors STR_ERROR_CAN_T_CHANGE_COMPANY_NAME :{WHITE}Can't change company name... @@ -4313,6 +4316,7 @@ STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST :{WHITE}Must dem STR_ERROR_CAN_T_START_AND_END_ON :{WHITE}Can't start and end in the same spot STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT :{WHITE}Bridge heads not at the same level STR_ERROR_BRIDGE_TOO_LOW_FOR_TERRAIN :{WHITE}Bridge is too low for the terrain +STR_ERROR_BRIDGE_TOO_HIGH_FOR_TERRAIN :{WHITE}Bridge is too high for this terrain. STR_ERROR_START_AND_END_MUST_BE_IN :{WHITE}Start and end must be in line STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH :{WHITE}... ends of bridge must both be on land STR_ERROR_BRIDGE_TOO_LONG :{WHITE}... bridge too long diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 320b19d08..bd8eb91ca 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1604,6 +1604,7 @@ static SettingsContainer &GetSettingsTree() limitations->Add(new SettingEntry("construction.autoslope")); limitations->Add(new SettingEntry("construction.extra_dynamite")); limitations->Add(new SettingEntry("construction.max_bridge_length")); + limitations->Add(new SettingEntry("construction.max_bridge_height")); limitations->Add(new SettingEntry("construction.max_tunnel_length")); limitations->Add(new SettingEntry("station.never_expire_airports")); limitations->Add(new SettingEntry("vehicle.never_expire_vehicles")); diff --git a/src/table/settings.ini b/src/table/settings.ini index e74b11e52..a2d6841fd 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -517,6 +517,8 @@ def = 12 min = 1 max = MAX_TILE_HEIGHT interval = 1 +str = STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT +strhelp = STR_CONFIG_SETTING_MAX_BRIDGE_HEIGHT_HELPTEXT strval = STR_JUST_COMMA cat = SC_EXPERT diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp index 50ae42f6b..82554d43e 100644 --- a/src/terraform_cmd.cpp +++ b/src/terraform_cmd.cpp @@ -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)) { diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 49b987d0a..d4b794633 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -391,6 +391,16 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u for (TileIndex tile = tile_start + delta; tile != tile_end; tile += delta) { if (GetTileMaxZ(tile) > z_start) return_cmd_error(STR_ERROR_BRIDGE_TOO_LOW_FOR_TERRAIN); + if (z_start >= (GetTileZ(tile) + _settings_game.construction.max_bridge_height)) { + /* + * Disallow too high bridges. + * Properly rendering a map where very high bridges (might) exist is expensive. + * See http://www.tt-forums.net/viewtopic.php?f=33&t=40844&start=980#p1131762 + * for a detailed discussion. z_start here is one heightlevel below the bridge level. + */ + return_cmd_error(STR_ERROR_BRIDGE_TOO_HIGH_FOR_TERRAIN); + } + if (IsBridgeAbove(tile)) { /* Disallow crossing bridges for the time being */ return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); |