diff --git a/src/lang/english.txt b/src/lang/english.txt index 512499c061..706d9a97fd 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -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} diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index e40879cf9f..8d10ccdd7a 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -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); + } } } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 088cdae680..6645fb6ded 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -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)); diff --git a/src/settings_type.h b/src/settings_type.h index 939eb61624..1d7139c332 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -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? diff --git a/src/table/settings.ini b/src/table/settings.ini index bf72e08e9a..1607f08493 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -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 diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 5d1c3d206e..81c574dcb9 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -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;