Add setting to allow placing all NewGRF objects under bridges

pull/73/head
Jonathan G Rennison 6 years ago
parent 035c00b521
commit 56bde8ce18

@ -1881,6 +1881,9 @@ STR_CONFIG_SETTING_ENABLE_ROAD_CUSTOM_BRIDGE_HEADS_HELPTEXT :Allow road brid
STR_CONFIG_SETTING_ENABLE_RAIL_CUSTOM_BRIDGE_HEADS :Enable rail custom bridge heads: {STRING2}
STR_CONFIG_SETTING_ENABLE_RAIL_CUSTOM_BRIDGE_HEADS_HELPTEXT :Allow rail bridges to have custom, non-straight flat entry/exit tiles
STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES :Allow all NewGRF objects under bridges: {STRING2}
STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES_HELPTEXT :Allow all NewGRF objects to be built under bridges, even where not otherwise enabled by the GRF.{}This may result in graphical issues.
STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Change setting value
STR_CONFIG_SETTING_ADJACENT_CROSSINGS :Close adjacent level crossings: {STRING2}

@ -294,11 +294,13 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (cost.Failed()) return cost;
/* Finally do a check for bridges. */
TILE_AREA_LOOP(t, ta) {
if (IsBridgeAbove(t) && (
!(spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) ||
(GetTileMaxZ(t) + spec->height >= GetBridgeHeight(GetSouthernBridgeEnd(t))))) {
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
if (type < NEW_OBJECT_OFFSET || !_settings_game.construction.allow_grf_objects_under_bridges) {
TILE_AREA_LOOP(t, ta) {
if (IsBridgeAbove(t) && (
!(spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) ||
(GetTileMaxZ(t) + spec->height >= GetBridgeHeight(GetSouthernBridgeEnd(t))))) {
return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
}
}
}

@ -1743,6 +1743,7 @@ static SettingsContainer &GetSettingsTree()
limitations->Add(new SettingEntry("construction.enable_remove_water"));
limitations->Add(new SettingEntry("construction.road_custom_bridge_heads"));
limitations->Add(new SettingEntry("construction.rail_custom_bridge_heads"));
limitations->Add(new SettingEntry("construction.allow_grf_objects_under_bridges"));
}
SettingsPage *disasters = main->Add(new SettingsPage(STR_CONFIG_SETTING_ACCIDENTS));

@ -376,6 +376,7 @@ struct ConstructionSettings {
uint8 road_custom_bridge_heads; ///< allow construction of road custom bridge heads
bool chunnel; ///< allow construction of tunnels under water
uint8 rail_custom_bridge_heads; ///< allow construction of rail custom bridge heads
bool allow_grf_objects_under_bridges; ///< allow all NewGRF objects under bridges
uint32 terraform_per_64k_frames; ///< how many tile heights may, over a long period, be terraformed per 65536 frames?
uint16 terraform_frame_burst; ///< how many tile heights may, over a short period, be terraformed?

@ -1473,6 +1473,15 @@ str = STR_CONFIG_SETTING_ENABLE_RAIL_CUSTOM_BRIDGE_HEADS
strhelp = STR_CONFIG_SETTING_ENABLE_RAIL_CUSTOM_BRIDGE_HEADS_HELPTEXT
patxname = ""custom_bridge_heads.construction.rail_custom_bridge_heads""
[SDT_BOOL]
base = GameSettings
var = construction.allow_grf_objects_under_bridges
def = false
cat = SC_EXPERT
str = STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES
strhelp = STR_CONFIG_SETTING_ALLOW_GRF_OBJECTS_UNDER_BRIDGES_HELPTEXT
patxname = ""allow_grf_objects_under_bridges.construction.allow_grf_objects_under_bridges""
[SDT_BOOL]
base = GameSettings
var = station.adjacent_stations

@ -493,6 +493,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
break;
case MP_OBJECT: {
if (_settings_game.construction.allow_grf_objects_under_bridges && GetObjectType(tile) >= NEW_OBJECT_OFFSET) break;
const ObjectSpec *spec = ObjectSpec::GetByTile(tile);
if ((spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) == 0) goto not_valid_below;
if (GetTileMaxZ(tile) + spec->height > z_start) goto not_valid_below;

Loading…
Cancel
Save