diff --git a/src/lang/english.txt b/src/lang/english.txt index 08d7dc5b4b..c8e0d4276f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1918,6 +1918,8 @@ STR_CONFIG_SETTING_TOWN_CARGO_FACTOR :Town cargo gene STR_CONFIG_SETTING_TOWN_CARGO_FACTOR_HELPTEXT :Passenger, mail, and other town cargo production is scaled by approximately 2^factor (exponential) STR_CONFIG_SETTING_INDUSTRY_CARGO_FACTOR :Industry cargo generation factor (less < 0 < more): {STRING2} STR_CONFIG_SETTING_INDUSTRY_CARGO_FACTOR_HELPTEXT :Primary industry cargo production is scaled by approximately 2^factor (exponential). This excludes tree-cutting industries.{}This is not guaranteed to be fully compatible with all industry NewGRFs. +STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT :No towns above height level: {STRING2} +STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT_HELPTEXT :No towns above the specified height level are built during map creation. STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT :In game placement of trees: {STRING2} STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT :Control random appearance of trees during the game. This might affect industries which rely on tree growth, for example lumber mills diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index f5a8af3ce6..f9105263a6 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2036,6 +2036,7 @@ static SettingsContainer &GetSettingsTree() genworld->Add(new SettingEntry("economy.initial_city_size")); genworld->Add(new SettingEntry("economy.town_layout")); genworld->Add(new SettingEntry("economy.town_min_distance")); + genworld->Add(new SettingEntry("economy.max_town_heightlevel")); genworld->Add(new SettingEntry("difficulty.industry_density")); genworld->Add(new SettingEntry("gui.pause_on_newgame")); genworld->Add(new SettingEntry("game_creation.ending_year")); diff --git a/src/settings_type.h b/src/settings_type.h index 1ad161930f..f41dc7724e 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -633,6 +633,7 @@ struct EconomySettings { TownCargoGenMode town_cargogen_mode; ///< algorithm for generating cargo from houses, @see TownCargoGenMode bool allow_town_roads; ///< towns are allowed to build roads (always allowed when generating world / in SE) uint16 town_min_distance; ///< minimum distance between towns + uint8 max_town_heightlevel; ///< maximum height level for towns TownFounding found_town; ///< town founding. bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits uint16 town_noise_population[3]; ///< population to base decision on noise evaluation (@see town_council_tolerance) diff --git a/src/table/settings.ini b/src/table/settings.ini index 7c02b39b9b..9d8daed921 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -939,10 +939,24 @@ strhelp = STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT strval = STR_CONFIG_SETTING_TOWN_CARGOGENMODE_ORIGINAL cat = SC_ADVANCED -;; economy.max_town_heightlevel -[SDT_NULL] -length = 1 +[SDT_XREF] extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_JOKERPP) +xref = ""economy.max_town_heightlevel"" + +[SDT_VAR] +base = GameSettings +var = economy.max_town_heightlevel +type = SLE_UINT8 +guiflags = SGF_NEWGAME_ONLY | SGF_SCENEDIT_TOO +def = MAX_MAP_HEIGHT_LIMIT +min = 4 +max = MAX_MAP_HEIGHT_LIMIT +interval = 1 +str = STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT +strhelp = STR_CONFIG_SETTING_TOWN_ABOVE_HEIGHT_HELPTEXT +strval = STR_JUST_INT +cat = SC_BASIC +patxname = ""max_town_heightlevel.economy.max_town_heightlevel"" ; link graph diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 854c88192e..45aca23d81 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2118,6 +2118,11 @@ static CommandCost TownCanBePlacedHere(TileIndex tile) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_TOWN); } + /* Check max height level. */ + if (GetTileZ(tile) > _settings_game.economy.max_town_heightlevel) { + return_cmd_error(STR_ERROR_SITE_UNSUITABLE); + } + /* Can only build on clear flat areas, possibly with trees. */ if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || !IsTileFlat(tile)) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE);