diff --git a/src/lang/english.txt b/src/lang/english.txt index 706d9a97fd..1a1443795e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1884,6 +1884,9 @@ STR_CONFIG_SETTING_ENABLE_RAIL_CUSTOM_BRIDGE_HEADS_HELPTEXT :Allow rail brid 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_ALLOW_STATIONS_UNDER_BRIDGES :Allow stations under bridges: {STRING2} +STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES_HELPTEXT :Allow stations to be built under bridges.{}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/settings_gui.cpp b/src/settings_gui.cpp index 6645fb6ded..15212d0b27 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1744,6 +1744,7 @@ static SettingsContainer &GetSettingsTree() 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")); + limitations->Add(new SettingEntry("construction.allow_stations_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 1d7139c332..fba0f299ec 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -377,6 +377,7 @@ struct ConstructionSettings { 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 + bool allow_stations_under_bridges; ///< allow all station tiles 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/station_cmd.cpp b/src/station_cmd.cpp index 5b88de3d3a..700eeec484 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -733,7 +733,7 @@ CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags); */ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z, bool allow_steep, bool check_bridge = true) { - if (check_bridge && IsBridgeAbove(tile)) { + if (check_bridge && IsBridgeAbove(tile) && !_settings_game.construction.allow_stations_under_bridges) { return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); } @@ -2619,7 +2619,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 CommandCost ret = CheckIfAuthorityAllowsNewStation(slope_tile, flags); if (ret.Failed()) return ret; - if (IsBridgeAbove(slope_tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); + if (IsBridgeAbove(slope_tile) && !_settings_game.construction.allow_stations_under_bridges) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); ret = DoCommand(slope_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); if (ret.Failed()) return ret; @@ -2628,7 +2628,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } - if (IsBridgeAbove(flat_tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); + if (IsBridgeAbove(flat_tile) && !_settings_game.construction.allow_stations_under_bridges) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); /* Get the water class of the water tile before it is cleared.*/ WaterClass wc = GetWaterClass(flat_tile); @@ -3080,6 +3080,7 @@ draw_default_foundation: } DrawRailTileSeq(ti, t, TO_BUILDINGS, total_offset, relocation, palette); + DrawBridgeMiddle(ti); } void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image) diff --git a/src/table/settings.ini b/src/table/settings.ini index 1607f08493..0e507c5840 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -1482,6 +1482,15 @@ 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 = construction.allow_stations_under_bridges +def = false +cat = SC_EXPERT +str = STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES +strhelp = STR_CONFIG_SETTING_ALLOW_STATIONS_UNDER_BRIDGES_HELPTEXT +patxname = ""allow_stations_under_bridges.construction.allow_stations_under_bridges"" + [SDT_BOOL] base = GameSettings var = station.adjacent_stations diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 81c574dcb9..57b53a33fe 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -46,6 +46,7 @@ #include "viewport_func.h" #include "station_map.h" #include "industry_map.h" +#include "object_map.h" #include "table/strings.h" #include "table/bridge_land.h" @@ -500,6 +501,11 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u break; } + case MP_STATION: { + if (!_settings_game.construction.allow_stations_under_bridges) goto not_valid_below; + break; + } + case MP_CLEAR: break; diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 4d54d3f692..3aa501c299 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -133,7 +133,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID * return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); } - if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); + if (IsBridgeAbove(tile) && !_settings_game.construction.allow_stations_under_bridges) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); return CommandCost(); } @@ -289,7 +289,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE); - if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); + if (IsBridgeAbove(tile) && !_settings_game.construction.allow_stations_under_bridges) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); if (!IsTileFlat(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);