From 7c6d73abfa4a8205bc68963e64e7967db2916330 Mon Sep 17 00:00:00 2001 From: reldred Date: Wed, 24 Mar 2021 17:46:09 +1030 Subject: [PATCH] Create new branch. Goals: Make rocks size patches and frequency configruable. Optional but highly desired: Make rocks denser/more frequent the higher the altitude (make that an optional bool?) Also the number display is screwed in the settings gui. Same problem as my other patch. Need to compare it to what I did for the other var I did recently (tiles width around rivers to make desert go away) and fix this. This will do to start with. --- src/clear_cmd.cpp | 2 +- src/lang/english.txt | 2 ++ src/settings_gui.cpp | 1 + src/settings_type.h | 1 + src/table/settings.ini | 12 ++++++++++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 613a686ce8..279f6aba89 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -365,7 +365,7 @@ void GenerateClearTile() IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY); if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) { - uint j = GB(r, 16, 4) + 5; + uint j = GB(r, 16, 4) + _settings_game.game_creation.amount_of_rocks; for (;;) { TileIndex tile_new; diff --git a/src/lang/english.txt b/src/lang/english.txt index 4e06f12189..abe367da5e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1459,6 +1459,8 @@ STR_CONFIG_SETTING_VARIETY :Variety distrib STR_CONFIG_SETTING_VARIETY_HELPTEXT :(TerraGenesis only) Control whether the map contains both mountainous and flat areas. Since this only makes the map flatter, other settings should be set to mountainous STR_CONFIG_SETTING_RIVER_AMOUNT :River amount: {STRING2} STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Choose how many rivers to generate +STR_CONFIG_SETTING_ROCKS_AMOUNT :Rocks amount: {NUM} +STR_CONFIG_SETTING_ROCKS_AMOUNT_HELPTEXT :Choose how many rocky patches to generate STR_CONFIG_SETTING_TREE_PLACER :Tree placer algorithm: {STRING2} STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Choose the distribution of trees on the map: 'Original' plants trees uniformly scattered, 'Improved' plants them in groups STR_CONFIG_SETTING_TREE_PLACER_NONE :None diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 41840484c4..576759eddf 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1816,6 +1816,7 @@ static SettingsContainer &GetSettingsTree() genworld->Add(new SettingEntry("game_creation.snow_line_height")); genworld->Add(new SettingEntry("game_creation.rainforest_line_height")); genworld->Add(new SettingEntry("game_creation.amount_of_rivers")); + genworld->Add(new SettingEntry("game_creation.amount_of_rocks")); genworld->Add(new SettingEntry("game_creation.tree_placer")); genworld->Add(new SettingEntry("vehicle.road_side")); genworld->Add(new SettingEntry("economy.larger_towns")); diff --git a/src/settings_type.h b/src/settings_type.h index 703eb3184c..c3bcd00f4e 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -375,6 +375,7 @@ struct GameCreationSettings { byte min_river_length; ///< the minimum river length byte river_route_random; ///< the amount of randomicity for the route finding byte amount_of_rivers; ///< the amount of rivers + byte amount_of_rocks; ///< the amoutn of rocks }; /** Settings related to construction in-game */ diff --git a/src/table/settings.ini b/src/table/settings.ini index 9fc468bf4d..a69768e31c 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -3750,6 +3750,18 @@ str = STR_CONFIG_SETTING_RIVER_AMOUNT strhelp = STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT strval = STR_RIVERS_NONE +[SDT_VAR] +base = GameSettings +var = game_creation.amount_of_rocks +type = SLE_UINT8 +def = 5 +min = 1 +max = 255 +interval = 1 +str = STR_CONFIG_SETTING_ROCKS_AMOUNT +strhelp = STR_CONFIG_SETTING_ROCKS_AMOUNT_HELPTEXT +strval = STR_JUST_COMMA + ;;game_creation.build_public_roads [SDT_NULL] length = 1