Add setting to allow placing stations under bridges
This commit is contained in:
@@ -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}
|
||||
|
@@ -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));
|
||||
|
@@ -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?
|
||||
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user