Feature: Setting to disallow level crossings with competitors (#10755)

This commit is contained in:
mrmbernardi 2023-09-02 12:46:24 +02:00 committed by GitHub
parent 236ec41fa2
commit a5c8365aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 0 deletions

View File

@ -1426,6 +1426,9 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :None*
STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :Reduced
STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :Normal
STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :Allow level crossings with roads or rails owned by competitors: {STRING2}
STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :Allow construction of level crossings on roads or rails owned by competitors
STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Allow drive-through road stops on roads owned by towns: {STRING2}
STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Allow construction of drive-through road stops on roads owned by towns
STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD :Allow drive-through road stops on roads owned by competitors: {STRING2}

View File

@ -507,6 +507,11 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai
/* Level crossings may only be built on these slopes */
if (!HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
if (!_settings_game.construction.crossing_with_competitor && _current_company != OWNER_DEITY) {
CommandCost ret = CheckTileOwnership(tile);
if (ret.Failed()) return ret;
}
CommandCost ret = EnsureNoVehicleOnGround(tile);
if (ret.Failed()) return ret;

View File

@ -737,6 +737,11 @@ CommandCost CmdBuildRoad(DoCommandFlag flags, TileIndex tile, RoadBits pieces, R
return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
}
if (!_settings_game.construction.crossing_with_competitor && company != OWNER_TOWN && company != OWNER_DEITY) {
CommandCost ret = CheckTileOwnership(tile);
if (ret.Failed()) return ret;
}
if (GetRailTileType(tile) != RAIL_TILE_NORMAL) goto do_clear;
if (RoadNoLevelCrossing(rt)) {

View File

@ -1932,6 +1932,7 @@ static SettingsContainer &GetSettingsTree()
limitations->Add(new SettingEntry("station.distant_join_stations"));
limitations->Add(new SettingEntry("construction.road_stop_on_town_road"));
limitations->Add(new SettingEntry("construction.road_stop_on_competitor_road"));
limitations->Add(new SettingEntry("construction.crossing_with_competitor"));
limitations->Add(new SettingEntry("vehicle.disable_elrails"));
}

View File

@ -368,6 +368,7 @@ struct ConstructionSettings {
bool extra_dynamite; ///< extra dynamite
bool road_stop_on_town_road; ///< allow building of drive-through road stops on town owned roads
bool road_stop_on_competitor_road; ///< allow building of drive-through road stops on roads owned by competitors
bool crossing_with_competitor; ///< allow building of level crossings with competitor roads or rails
uint8_t raw_industry_construction; ///< type of (raw) industry construction (none, "normal", prospecting)
uint8_t industry_platform; ///< the amount of flat land around an industry
bool freeform_edges; ///< allow terraforming the tiles at the map edges

View File

@ -523,6 +523,13 @@ str = STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD
strhelp = STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT
cat = SC_BASIC
[SDT_BOOL]
var = construction.crossing_with_competitor
def = true
str = STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR
strhelp = STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT
cat = SC_BASIC
[SDT_VAR]
var = construction.raw_industry_construction
type = SLE_UINT8