1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 00:42:45 +01:00

Add: Setting to control minimum distance between towns. (#14893)

Backported from JGRPP.
This commit is contained in:
Peter Nelson
2025-12-11 11:28:04 +00:00
committed by GitHub
parent a2304154d4
commit ef4687895e
5 changed files with 16 additions and 1 deletions

View File

@@ -2092,6 +2092,8 @@ STR_CONFIG_SETTING_LARGER_TOWNS_VALUE :1 in {COMMA}
STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :None
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Initial city size multiplier: {STRING2}
STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Average size of cities relative to normal towns at start of the game
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_LINKGRAPH_RECALC_INTERVAL :Update distribution graph every {STRING2}
STR_CONFIG_SETTING_LINKGRAPH_RECALC_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 seconds. 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

@@ -881,6 +881,7 @@ SettingsContainer &GetSettingsTree()
towns->Add(new SettingEntry("economy.town_layout"));
towns->Add(new SettingEntry("economy.larger_towns"));
towns->Add(new SettingEntry("economy.initial_city_size"));
towns->Add(new SettingEntry("economy.town_min_distance"));
towns->Add(new SettingEntry("economy.town_cargogen_mode"));
}

View File

@@ -565,6 +565,7 @@ struct EconomySettings {
uint16_t minutes_per_calendar_year; ///< minutes per calendar year. Special value 0 means that calendar time is frozen.
uint16_t town_cargo_scale; ///< scale cargo production of towns by this percentage.
uint16_t industry_cargo_scale; ///< scale cargo production of industries by this percentage.
uint16_t town_min_distance; ///< minimum distance between towns.
};
struct LinkGraphSettings {

View File

@@ -249,6 +249,17 @@ str = STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER
strhelp = STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT
strval = STR_JUST_COMMA
[SDT_VAR]
var = economy.town_min_distance
type = SLE_UINT16
def = 20
min = 10
max = 500
interval = 5
str = STR_CONFIG_SETTING_TOWN_MIN_DISTANCE
strhelp = STR_CONFIG_SETTING_TOWN_MIN_DISTANCE_HELPTEXT
strval = STR_JUST_INT
[SDT_BOOL]
var = economy.mod_road_rebuild
from = SLV_77

View File

@@ -2124,7 +2124,7 @@ static CommandCost TownCanBePlacedHere(TileIndex tile, bool check_surrounding)
}
/* Check distance to all other towns. */
if (IsCloseToTown(tile, 20)) {
if (IsCloseToTown(tile, _settings_game.economy.town_min_distance)) {
return CommandCost(STR_ERROR_TOO_CLOSE_TO_ANOTHER_TOWN);
}