Add PR #228: New configure town zone multipliers

pull/231/head
reldred 3 years ago committed by Jonathan G Rennison
parent 8098274892
commit 67c256f437

@ -1884,6 +1884,19 @@ STR_CONFIG_SETTING_ZOOM_LVL_OUT_16X :16x
STR_CONFIG_SETTING_ZOOM_LVL_OUT_32X :32x
STR_CONFIG_SETTING_ZOOM_LVL_OUT_64X :64x
STR_CONFIG_SETTING_ZOOM_LVL_OUT_128X :128x
STR_CONFIG_SETTING_TOWN_ZONES :{ORANGE}Custom town zones
STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE :Use custom town zone calculations: {STRING2}
STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE_HELPTEXT :Allows manually configuring the size of town zones generated by towns. The default values for custom town zone settings are similar to the default town generation. Some zones only require small changes while Zone 0 in particular benefits from larger values.
STR_CONFIG_SETTING_TOWN_ZONE_0_MULT :Multiplier for Zone 0: {STRING2}
STR_CONFIG_SETTING_TOWN_ZONE_0_MULT_HELPTEXT :Multiplier for the size of Zone 0 (Outermost roads with no pavement). This setting can benefit from large values.
STR_CONFIG_SETTING_TOWN_ZONE_1_MULT :Multiplier for Zone 1: {STRING2}
STR_CONFIG_SETTING_TOWN_ZONE_1_MULT_HELPTEXT :Multiplier for the size of Zone 1 (Outer zone with pavements). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_2_MULT :Multiplier for Zone 2: {STRING2}
STR_CONFIG_SETTING_TOWN_ZONE_2_MULT_HELPTEXT :Multiplier for the size of Zone 2 (Outer zone with pavements). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_3_MULT :Multiplier for Zone 3: {STRING2}
STR_CONFIG_SETTING_TOWN_ZONE_3_MULT_HELPTEXT :Multiplier for the size of Zone 3 (Inner tree-lined roads). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_4_MULT :Multiplier for Zone 4: {STRING2}
STR_CONFIG_SETTING_TOWN_ZONE_4_MULT_HELPTEXT :Multiplier for the size of Zone 4 (Innermost roads with street lights). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_GROWTH :Town growth speed: {STRING2}
STR_CONFIG_SETTING_TOWN_GROWTH_HELPTEXT :Speed of town growth
STR_CONFIG_SETTING_TOWN_GROWTH_CARGO_TRANSPORTED :Town growth speed depends on transported cargo: {STRING2}

@ -1554,6 +1554,18 @@ STR_CONFIG_SETTING_ZOOM_LVL_NORMAL :Normal
STR_CONFIG_SETTING_ZOOM_LVL_OUT_2X :2x
STR_CONFIG_SETTING_ZOOM_LVL_OUT_4X :4x
STR_CONFIG_SETTING_ZOOM_LVL_OUT_8X :8x
STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE :Use custom Town Zone calculations: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE_HELPTEXT :Allows manually configuring the size of town zones generated by towns. The default values for custom town zone settings are similar to the default town generation. Some zones only require small changes while Zone 0 in particular benefits from larger values.
STR_CONFIG_SETTING_TOWN_ZONE_0_MULT :Multiplier to Zone 0: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_0_MULT_HELPTEXT :Multiplier to the size of Zone 0 (Outer most roads with no sidewalks). This setting can benefit from large values.
STR_CONFIG_SETTING_TOWN_ZONE_1_MULT :Multiplier to Zone 1: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_1_MULT_HELPTEXT :Multiplier to the size of Zone 1 (Outer zone with sidewalks). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_2_MULT :Multiplier to Zone 2: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_2_MULT_HELPTEXT :Multiplier to the size of Zone 2 (Outer zone with sidewalks). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_3_MULT :Multiplier to Zone 3: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_3_MULT_HELPTEXT :Multiplier to the size of Zone 3 (Inner tree-lined roads). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_4_MULT :Multiplier to Zone 4: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_4_MULT_HELPTEXT :Multiplier to the size of Zone 4 (Inner most roads with street lights). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_GROWTH :Town growth speed: {STRING}
STR_CONFIG_SETTING_TOWN_GROWTH_HELPTEXT :Speed of town growth
STR_CONFIG_SETTING_TOWN_GROWTH_NONE :None

@ -1658,6 +1658,18 @@ STR_CONFIG_SETTING_ZOOM_LVL_OUT_4X :4x
STR_CONFIG_SETTING_ZOOM_LVL_OUT_8X :8x
STR_CONFIG_SETTING_TOWN_GROWTH :Town growth speed: {STRING}
STR_CONFIG_SETTING_TOWN_GROWTH_HELPTEXT :Speed of town growth
STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE :Use custom Town Zone calculations: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE_HELPTEXT :Allows manually configuring the size of town zones generated by towns. The default values for custom town zone settings are similar to the default town generation. Some zones only require small changes while Zone 0 in particular benefits from larger values.
STR_CONFIG_SETTING_TOWN_ZONE_0_MULT :Multiplier to Zone 0: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_0_MULT_HELPTEXT :Multiplier to the size of Zone 0 (Outer most roads with no sidewalks). This setting can benefit from large values.
STR_CONFIG_SETTING_TOWN_ZONE_1_MULT :Multiplier to Zone 1: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_1_MULT_HELPTEXT :Multiplier to the size of Zone 1 (Outer zone with sidewalks). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_2_MULT :Multiplier to Zone 2: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_2_MULT_HELPTEXT :Multiplier to the size of Zone 2 (Outer zone with sidewalks). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_3_MULT :Multiplier to Zone 3: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_3_MULT_HELPTEXT :Multiplier to the size of Zone 3 (Inner tree-lined roads). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_ZONE_4_MULT :Multiplier to Zone 4: {STRING}
STR_CONFIG_SETTING_TOWN_ZONE_4_MULT_HELPTEXT :Multiplier to the size of Zone 4 (Inner most roads with street lights). This setting works best with minor alterations.
STR_CONFIG_SETTING_TOWN_GROWTH_NONE :None
STR_CONFIG_SETTING_TOWN_GROWTH_SLOW :Slow
STR_CONFIG_SETTING_TOWN_GROWTH_NORMAL :Normal

@ -1298,6 +1298,12 @@ static bool ZoomMinMaxChanged(int32 p1)
return true;
}
static bool InvalidateSettingsWindow(int32 p1)
{
InvalidateWindowClassesData(WC_GAME_OPTIONS);
return true;
}
/**
* Update any possible saveload window and delete any newgrf dialogue as
* its widget parts might change. Reinit all windows as it allows access to the

@ -1843,6 +1843,18 @@ static SettingsContainer &GetSettingsTree()
{
towns->Add(new SettingEntry("economy.town_growth_rate"));
towns->Add(new SettingEntry("economy.town_growth_cargo_transported"));
towns->Add(new SettingEntry("economy.town_zone_calc_mode"));
SettingsPage *town_zone = towns->Add(new SettingsPage(STR_CONFIG_SETTING_TOWN_ZONES));
{
town_zone->hide_callback = []() -> bool {
return !GetGameSettings().economy.town_zone_calc_mode;
};
town_zone->Add(new SettingEntry("economy.town_zone_0_mult"));
town_zone->Add(new SettingEntry("economy.town_zone_1_mult"));
town_zone->Add(new SettingEntry("economy.town_zone_2_mult"));
town_zone->Add(new SettingEntry("economy.town_zone_3_mult"));
town_zone->Add(new SettingEntry("economy.town_zone_4_mult"));
}
towns->Add(new SettingEntry("economy.allow_town_roads"));
towns->Add(new SettingEntry("economy.allow_town_level_crossings"));
towns->Add(new SettingEntry("economy.found_town"));

@ -601,6 +601,12 @@ struct EconomySettings {
bool multiple_industry_per_town; ///< allow many industries of the same type per town
int8 town_growth_rate; ///< town growth rate
uint8 town_growth_cargo_transported; ///< percentage of town growth rate which depends on proportion of transported cargo in the last month
bool town_zone_calc_mode; ///< calc mode for town zones
uint16 town_zone_0_mult; ///< multiplier for the size of zone 0
uint16 town_zone_1_mult; ///< multiplier for the size of zone 1
uint16 town_zone_2_mult; ///< multiplier for the size of zone 2
uint16 town_zone_3_mult; ///< multiplier for the size of zone 3
uint16 town_zone_4_mult; ///< multiplier for the size of zone 4
uint8 larger_towns; ///< the number of cities to build. These start off larger and grow twice as fast
uint8 initial_city_size; ///< multiplier for the initial size of the cities compared to towns
TownLayout town_layout; ///< select town layout, @see TownLayout

@ -48,6 +48,7 @@ static bool RedrawTownAuthority(int32 p1);
static bool InvalidateCompanyInfrastructureWindow(int32 p1);
static bool InvalidateCompanyWindow(int32 p1);
static bool ZoomMinMaxChanged(int32 p1);
static bool InvalidateSettingsWindow(int32 p1);
static bool MaxVehiclesChanged(int32 p1);
static bool InvalidateShipPathCache(int32 p1);
static bool ImprovedBreakdownsSettingChanged(int32 p1);
@ -2399,6 +2400,86 @@ strhelp = STR_CONFIG_SETTING_TOWN_GROWTH_HELPTEXT
strval = STR_CONFIG_SETTING_TOWN_GROWTH_EXTREME_SLOW
orderproc = OrderTownGrowthRate
[SDT_BOOL]
base = GameSettings
var = economy.town_zone_calc_mode
def = false
str = STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE
strhelp = STR_CONFIG_SETTING_TOWN_ZONE_CALC_MODE_HELPTEXT
proc = InvalidateSettingsWindow
cat = SC_EXPERT
patxname = ""town_zone.economy.town_zone_calc_mode""
[SDT_VAR]
base = GameSettings
var = economy.town_zone_0_mult
type = SLE_UINT16
def = 15
min = 0
max = 255
interval = 1
str = STR_CONFIG_SETTING_TOWN_ZONE_0_MULT
strhelp = STR_CONFIG_SETTING_TOWN_ZONE_0_MULT_HELPTEXT
strval = STR_JUST_COMMA
cat = SC_EXPERT
patxname = ""town_zone.economy.town_zone_0_mult""
[SDT_VAR]
base = GameSettings
var = economy.town_zone_1_mult
type = SLE_UINT16
def = 9
min = 0
max = 255
interval = 1
str = STR_CONFIG_SETTING_TOWN_ZONE_1_MULT
strhelp = STR_CONFIG_SETTING_TOWN_ZONE_1_MULT_HELPTEXT
strval = STR_JUST_COMMA
cat = SC_EXPERT
patxname = ""town_zone.economy.town_zone_1_mult""
[SDT_VAR]
base = GameSettings
var = economy.town_zone_2_mult
type = SLE_UINT16
def = 0
min = 0
max = 255
interval = 1
str = STR_CONFIG_SETTING_TOWN_ZONE_2_MULT
strhelp = STR_CONFIG_SETTING_TOWN_ZONE_2_MULT_HELPTEXT
strval = STR_JUST_COMMA
cat = SC_EXPERT
patxname = ""town_zone.economy.town_zone_2_mult""
[SDT_VAR]
base = GameSettings
var = economy.town_zone_3_mult
type = SLE_UINT16
def = 5
min = 0
max = 255
interval = 1
str = STR_CONFIG_SETTING_TOWN_ZONE_3_MULT
strhelp = STR_CONFIG_SETTING_TOWN_ZONE_3_MULT_HELPTEXT
strval = STR_JUST_COMMA
cat = SC_EXPERT
patxname = ""town_zone.economy.town_zone_3_mult""
[SDT_VAR]
base = GameSettings
var = economy.town_zone_4_mult
type = SLE_UINT16
def = 3
min = 0
max = 255
interval = 1
str = STR_CONFIG_SETTING_TOWN_ZONE_4_MULT
strhelp = STR_CONFIG_SETTING_TOWN_ZONE_4_MULT_HELPTEXT
strval = STR_JUST_COMMA
cat = SC_EXPERT
patxname = ""town_zone.economy.town_zone_4_mult""
[SDT_VAR]
base = GameSettings
var = economy.town_growth_cargo_transported

@ -1978,7 +1978,14 @@ void UpdateTownRadius(Town *t)
{121, 81, 0, 49, 36}, // 88
};
if (t->cache.num_houses < 92) {
if (_settings_game.economy.town_zone_calc_mode) {
int mass = t->cache.num_houses / 8;
t->cache.squared_town_zone_radius[0] = mass * _settings_game.economy.town_zone_0_mult;
t->cache.squared_town_zone_radius[1] = mass * _settings_game.economy.town_zone_1_mult;
t->cache.squared_town_zone_radius[2] = mass * _settings_game.economy.town_zone_2_mult;
t->cache.squared_town_zone_radius[3] = mass * _settings_game.economy.town_zone_3_mult;
t->cache.squared_town_zone_radius[4] = mass * _settings_game.economy.town_zone_4_mult;
} else if (t->cache.num_houses < 92) {
memcpy(t->cache.squared_town_zone_radius, _town_squared_town_zone_radius_data[t->cache.num_houses / 4], sizeof(t->cache.squared_town_zone_radius));
} else {
int mass = t->cache.num_houses / 8;

Loading…
Cancel
Save