Import town bridges over rails patch

Add setting (default off)

From: https://www.tt-forums.net/viewtopic.php?f=33t=76052
This commit is contained in:
Jonathan G Rennison
2017-07-31 18:40:44 +01:00
parent 4db69283c1
commit 9ed0541e77
5 changed files with 17 additions and 4 deletions

View File

@@ -1740,6 +1740,8 @@ STR_CONFIG_SETTING_RANDOM_ROAD_RECONSTRUCTION :Probability of
STR_CONFIG_SETTING_RANDOM_ROAD_RECONSTRUCTION_HELPTEXT :The probability of town roads being randomly re-constructing (0 = off, 1000 = max)
STR_CONFIG_SETTING_TOWN_MIN_DISTANCE :Minimum distance between towns: {STRING2}
STR_CONFIG_SETTING_TOWN_MIN_DISTANCE_HELPTEXT :Set the minimum distance in tiles between towns for map generation and random founding
STR_CONFIG_SETTING_TOWN_ROAD_OVER_RAIL :Towns can build bridges over rails: {STRING2}
STR_CONFIG_SETTING_TOWN_ROAD_OVER_RAIL_HELPTEXT :Allow towns to build road bridges over railway tracks
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Update distribution graph every {STRING2}{NBSP}day{P 0:2 "" s}
STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :Time between subsequent recalculations of the link graph. Each recalculation calculates the plans for one component of the graph. That means that a value X for this setting does not mean the whole graph will be updated every X days. Only some component will. The shorter you set it the more CPU time will be necessary to calculate it. The longer you set it the longer it will take until the cargo distribution starts on new routes.

View File

@@ -1776,6 +1776,7 @@ static SettingsContainer &GetSettingsTree()
towns->Add(new SettingEntry("economy.found_town"));
towns->Add(new SettingEntry("economy.town_cargo_scale_factor"));
towns->Add(new SettingEntry("economy.random_road_reconstruction"));
towns->Add(new SettingEntry("economy.town_bridge_over_rail"));
}
SettingsPage *industries = environment->Add(new SettingsPage(STR_CONFIG_SETTING_ENVIRONMENT_INDUSTRIES));

View File

@@ -557,6 +557,7 @@ struct EconomySettings {
bool infrastructure_maintenance; ///< enable monthly maintenance fee for owner infrastructure
uint8 day_length_factor; ///< factor which the length of day is multiplied
uint16 random_road_reconstruction; ///< chance out of 1000 per tile loop for towns to start random road re-construction
bool town_bridge_over_rail; ///< enable towns to build bridges over rails
};
struct LinkGraphSettings {

View File

@@ -2110,6 +2110,15 @@ strval = STR_JUST_COMMA
cat = SC_BASIC
patxname = ""economy.random_road_reconstruction""
[SDT_BOOL]
base = GameSettings
var = economy.town_bridge_over_rail
def = false
str = STR_CONFIG_SETTING_TOWN_ROAD_OVER_RAIL
strhelp = STR_CONFIG_SETTING_TOWN_ROAD_OVER_RAIL_HELPTEXT
cat = SC_BASIC
patxname = ""economy.town_bridge_over_rail""
##
[SDT_VAR]
base = GameSettings

View File

@@ -1242,14 +1242,14 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi
const int delta = TileOffsByDiagDir(bridge_dir);
if (slope == SLOPE_FLAT) {
/* Bridges starting on flat tiles are only allowed when crossing rivers. */
/* Bridges starting on flat tiles are only allowed when crossing rivers or rails. */
do {
if (bridge_length++ >= 4) {
/* Allow to cross rivers, not big lakes. */
/* Allow to cross rivers, not big lakes, nor large amounts of rails. */
return false;
}
bridge_tile += delta;
} while (IsValidTile(bridge_tile) && IsWaterTile(bridge_tile) && !IsSea(bridge_tile));
} while (IsValidTile(bridge_tile) && ((IsWaterTile(bridge_tile) && !IsSea(bridge_tile)) || (_settings_game.economy.town_bridge_over_rail && IsPlainRailTile(bridge_tile))));
} else {
do {
if (bridge_length++ >= 11) {
@@ -1257,7 +1257,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi
return false;
}
bridge_tile += delta;
} while (IsValidTile(bridge_tile) && IsWaterTile(bridge_tile));
} while (IsValidTile(bridge_tile) && (IsWaterTile(bridge_tile) || (_settings_game.economy.town_bridge_over_rail && IsPlainRailTile(bridge_tile))));
}
/* no water tiles in between? */