Add setting for if/when towns can build tunnels
Default to allowed
This commit is contained in:
@@ -2188,6 +2188,13 @@ STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :Allow towns to
|
|||||||
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :Towns are allowed to build level crossings: {STRING2}
|
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :Towns are allowed to build level crossings: {STRING2}
|
||||||
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :Enabling this setting allows towns to build level crossings
|
STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :Enabling this setting allows towns to build level crossings
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_TOWN_TUNNELS :Towns are allowed to build tunnels: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_TOWN_TUNNELS_HELPTEXT :Under what conditions are towns allowed to build road tunnels
|
||||||
|
###length 3
|
||||||
|
STR_CONFIG_SETTING_TOWN_TUNNELS_FORBIDDEN :Forbidden
|
||||||
|
STR_CONFIG_SETTING_TOWN_TUNNELS_ALLOWED_OBSTRUCTION :Allowed only for small obstructions
|
||||||
|
STR_CONFIG_SETTING_TOWN_TUNNELS_ALLOWED :Allowed
|
||||||
|
|
||||||
STR_CONFIG_SETTING_NOISE_LEVEL :Allow town controlled noise level for airports: {STRING2}
|
STR_CONFIG_SETTING_NOISE_LEVEL :Allow town controlled noise level for airports: {STRING2}
|
||||||
STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :With this setting disabled, there can be two airports in each town. With this setting enabled, the number of airports in a town is limited by the noise acceptance of the town, which depends on population and airport size and distance
|
STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :With this setting disabled, there can be two airports in each town. With this setting enabled, the number of airports in a town is limited by the noise acceptance of the town, which depends on population and airport size and distance
|
||||||
|
|
||||||
|
@@ -2191,6 +2191,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
towns->Add(new SettingEntry("economy.town_zone_calc_mode"));
|
towns->Add(new SettingEntry("economy.town_zone_calc_mode"));
|
||||||
towns->Add(new SettingEntry("economy.allow_town_roads"));
|
towns->Add(new SettingEntry("economy.allow_town_roads"));
|
||||||
towns->Add(new SettingEntry("economy.allow_town_level_crossings"));
|
towns->Add(new SettingEntry("economy.allow_town_level_crossings"));
|
||||||
|
towns->Add(new SettingEntry("economy.town_build_tunnels"));
|
||||||
towns->Add(new SettingEntry("economy.found_town"));
|
towns->Add(new SettingEntry("economy.found_town"));
|
||||||
towns->Add(new SettingEntry("economy.town_cargogen_mode"));
|
towns->Add(new SettingEntry("economy.town_cargogen_mode"));
|
||||||
towns->Add(new SettingEntry("economy.town_cargo_scale_factor"));
|
towns->Add(new SettingEntry("economy.town_cargo_scale_factor"));
|
||||||
|
@@ -688,6 +688,7 @@ struct EconomySettings {
|
|||||||
uint sharing_fee[4]; ///< fees for infrastructure sharing for rail/road/water/air
|
uint sharing_fee[4]; ///< fees for infrastructure sharing for rail/road/water/air
|
||||||
bool sharing_payment_in_debt; ///< allow fee payment for companies with more loan than money (switch off to prevent MP exploits)
|
bool sharing_payment_in_debt; ///< allow fee payment for companies with more loan than money (switch off to prevent MP exploits)
|
||||||
bool allow_town_level_crossings; ///< towns are allowed to build level crossings
|
bool allow_town_level_crossings; ///< towns are allowed to build level crossings
|
||||||
|
TownTunnelMode town_build_tunnels; ///< if/when towns are allowed to build road tunnels
|
||||||
int8 old_town_cargo_factor; ///< old power-of-two multiplier for town (passenger, mail) generation. May be negative.
|
int8 old_town_cargo_factor; ///< old power-of-two multiplier for town (passenger, mail) generation. May be negative.
|
||||||
int16 town_cargo_scale_factor; ///< scaled power-of-two multiplier for town (passenger, mail) generation. May be negative.
|
int16 town_cargo_scale_factor; ///< scaled power-of-two multiplier for town (passenger, mail) generation. May be negative.
|
||||||
int16 industry_cargo_scale_factor; ///< scaled power-of-two multiplier for primary industry generation. May be negative.
|
int16 industry_cargo_scale_factor; ///< scaled power-of-two multiplier for primary industry generation. May be negative.
|
||||||
|
@@ -935,6 +935,20 @@ def = true
|
|||||||
str = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS
|
str = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS
|
||||||
strhelp = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
var = economy.town_build_tunnels
|
||||||
|
type = SLE_UINT8
|
||||||
|
flags = SF_GUI_DROPDOWN
|
||||||
|
def = TTM_ALLOWED
|
||||||
|
min = TTM_BEGIN
|
||||||
|
max = TTM_END - 1
|
||||||
|
interval = 1
|
||||||
|
str = STR_CONFIG_SETTING_TOWN_TUNNELS
|
||||||
|
strhelp = STR_CONFIG_SETTING_TOWN_TUNNELS_HELPTEXT
|
||||||
|
strval = STR_CONFIG_SETTING_TOWN_TUNNELS_FORBIDDEN
|
||||||
|
cat = SC_BASIC
|
||||||
|
patxname = ""economy.town_build_tunnels""
|
||||||
|
|
||||||
[SDT_XREF]
|
[SDT_XREF]
|
||||||
xref = ""economy.old_town_cargo_factor""
|
xref = ""economy.old_town_cargo_factor""
|
||||||
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_CHILLPP)
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_CHILLPP)
|
||||||
|
@@ -1426,6 +1426,8 @@ static bool GrowTownWithTunnel(const Town *t, const TileIndex tile, const DiagDi
|
|||||||
{
|
{
|
||||||
assert(tunnel_dir < DIAGDIR_END);
|
assert(tunnel_dir < DIAGDIR_END);
|
||||||
|
|
||||||
|
if (_settings_game.economy.town_build_tunnels == TTM_FORBIDDEN) return false;
|
||||||
|
|
||||||
Slope slope = GetTileSlope(tile);
|
Slope slope = GetTileSlope(tile);
|
||||||
|
|
||||||
/* Only consider building a tunnel if the starting tile is sloped properly. */
|
/* Only consider building a tunnel if the starting tile is sloped properly. */
|
||||||
@@ -1439,6 +1441,8 @@ static bool GrowTownWithTunnel(const Town *t, const TileIndex tile, const DiagDi
|
|||||||
|
|
||||||
/* There are two conditions for building tunnels: Under a mountain and under an obstruction. */
|
/* There are two conditions for building tunnels: Under a mountain and under an obstruction. */
|
||||||
if (CanRoadContinueIntoNextTile(t, tile, tunnel_dir)) {
|
if (CanRoadContinueIntoNextTile(t, tile, tunnel_dir)) {
|
||||||
|
if (_settings_game.economy.town_build_tunnels != TTM_ALLOWED) return false;
|
||||||
|
|
||||||
/* Only tunnel under a mountain if the slope is continuous for at least 4 tiles. We want tunneling to be a last resort for large hills. */
|
/* Only tunnel under a mountain if the slope is continuous for at least 4 tiles. We want tunneling to be a last resort for large hills. */
|
||||||
TileIndex slope_tile = tile;
|
TileIndex slope_tile = tile;
|
||||||
for (uint8 tiles = 0; tiles < 4; tiles++) {
|
for (uint8 tiles = 0; tiles < 4; tiles++) {
|
||||||
|
@@ -130,4 +130,14 @@ struct TransportedCargoStat {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** Town allow tunnel building setting values. It needs to be 8bits, because we save and load it as such */
|
||||||
|
enum TownTunnelMode : byte {
|
||||||
|
TTM_BEGIN = 0, ///< Used for iterations and limit testing
|
||||||
|
TTM_FORBIDDEN = 0, ///< Forbidden
|
||||||
|
TTM_OBSTRUCTION_ONLY, ///< Allowed only for tunnels under obstructions
|
||||||
|
TTM_ALLOWED, ///< Allowed in all cases (including through hills)
|
||||||
|
TTM_END, ///< Used for iterations and limit testing
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* TOWN_TYPE_H */
|
#endif /* TOWN_TYPE_H */
|
||||||
|
Reference in New Issue
Block a user