Add setting to limit length of continuous inclined roads built by towns
Default to max 4 tiles
This commit is contained in:
@@ -2195,6 +2195,11 @@ 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_OBSTRUCTION :Allowed only for small obstructions
|
||||||
STR_CONFIG_SETTING_TOWN_TUNNELS_ALLOWED :Allowed
|
STR_CONFIG_SETTING_TOWN_TUNNELS_ALLOWED :Allowed
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE :Limit towns building continuous inclined roads: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE_HELPTEXT :Limit the length of consecutive sloped road tiles which towns will build. This can be used to prevent towns from growing long straight road segments up or down mountain sides
|
||||||
|
STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE_VALUE :{NUM} tile{P "" s}
|
||||||
|
STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE_ZERO :No limit
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
@@ -494,7 +494,7 @@ extern const RoadBits _invalid_tileh_slopes_road[2][15] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
|
Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
|
||||||
|
|
||||||
void NotifyRoadLayoutChangedIfTileNonLeaf(TileIndex tile, RoadTramType rtt, RoadBits present_bits)
|
void NotifyRoadLayoutChangedIfTileNonLeaf(TileIndex tile, RoadTramType rtt, RoadBits present_bits)
|
||||||
{
|
{
|
||||||
@@ -1831,7 +1831,7 @@ struct DrawRoadTileStruct {
|
|||||||
* @param bits The RoadBits part
|
* @param bits The RoadBits part
|
||||||
* @return The resulting Foundation
|
* @return The resulting Foundation
|
||||||
*/
|
*/
|
||||||
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
|
Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
|
||||||
{
|
{
|
||||||
/* Flat land and land without a road doesn't require a foundation */
|
/* Flat land and land without a road doesn't require a foundation */
|
||||||
if (tileh == SLOPE_FLAT || bits == ROAD_NONE) return FOUNDATION_NONE;
|
if (tileh == SLOPE_FLAT || bits == ROAD_NONE) return FOUNDATION_NONE;
|
||||||
|
@@ -2192,6 +2192,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
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.town_build_tunnels"));
|
||||||
|
towns->Add(new SettingEntry("economy.town_max_road_slope"));
|
||||||
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"));
|
||||||
|
@@ -689,6 +689,7 @@ struct EconomySettings {
|
|||||||
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
|
TownTunnelMode town_build_tunnels; ///< if/when towns are allowed to build road tunnels
|
||||||
|
uint8 town_max_road_slope; ///< maximum number of consecutive sloped road tiles which towns are allowed to build
|
||||||
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.
|
||||||
|
@@ -949,6 +949,20 @@ strval = STR_CONFIG_SETTING_TOWN_TUNNELS_FORBIDDEN
|
|||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
patxname = ""economy.town_build_tunnels""
|
patxname = ""economy.town_build_tunnels""
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
var = economy.town_max_road_slope
|
||||||
|
type = SLE_UINT8
|
||||||
|
flags = SF_GUI_0_IS_SPECIAL
|
||||||
|
def = 4
|
||||||
|
min = 0
|
||||||
|
max = 8
|
||||||
|
interval = 1
|
||||||
|
str = STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE
|
||||||
|
strhelp = STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE_HELPTEXT
|
||||||
|
strval = STR_CONFIG_SETTING_TOWN_MAX_ROAD_SLOPE_VALUE
|
||||||
|
cat = SC_BASIC
|
||||||
|
patxname = ""economy.town_max_road_slope""
|
||||||
|
|
||||||
[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)
|
||||||
|
@@ -1592,6 +1592,35 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_settings_game.economy.town_max_road_slope > 0 && ((rcmd == ROAD_X) || (rcmd == ROAD_Y))) {
|
||||||
|
/* Limit consecutive sloped road tiles */
|
||||||
|
|
||||||
|
auto get_road_slope = [rcmd](TileIndex t) -> Slope {
|
||||||
|
Slope slope = GetTileSlope(t);
|
||||||
|
extern Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
|
||||||
|
ApplyFoundationToSlope(GetRoadFoundation(slope, rcmd), &slope);
|
||||||
|
return slope;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Slope slope = get_road_slope(tile);
|
||||||
|
if (slope != SLOPE_FLAT) {
|
||||||
|
const int delta = TileOffsByDiagDir(ReverseDiagDir(target_dir));
|
||||||
|
bool ok = false;
|
||||||
|
TileIndex t = tile;
|
||||||
|
for (uint i = 0; i < _settings_game.economy.town_max_road_slope; i++) {
|
||||||
|
t += delta;
|
||||||
|
if (!IsValidTile(t) || !IsNormalRoadTile(t) || GetRoadBits(t, RTT_ROAD) != rcmd || get_road_slope(t) != slope) {
|
||||||
|
ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ok) {
|
||||||
|
/* All tested tiles had the same incline, disallow road */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) {
|
} else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) {
|
||||||
/* Continue building on a partial road.
|
/* Continue building on a partial road.
|
||||||
* Should be always OK, so we only generate
|
* Should be always OK, so we only generate
|
||||||
|
Reference in New Issue
Block a user