mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r26882) -Feature: allow limiting the height of bridges (ic111)
This commit is contained in:
parent
fedc1acd62
commit
ce04c49e3d
|
@ -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
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue