Feature: Set a custom number of industries in map generation window (#10340)

This commit is contained in:
Tyler Trahan
2023-01-14 05:12:29 -05:00
committed by GitHub
parent 5c64cdcb79
commit 2206c73156
5 changed files with 47 additions and 5 deletions

View File

@@ -2236,10 +2236,14 @@ static uint GetNumberOfIndustries()
25, // low
55, // normal
80, // high
0, // custom
};
assert(lengthof(numof_industry_table) == ID_END);
uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.industry_density : (uint)ID_VERY_LOW;
if (difficulty == ID_CUSTOM) return std::min<uint>(IndustryPool::MAX_SIZE, _settings_game.game_creation.custom_industry_number);
return std::min<uint>(IndustryPool::MAX_SIZE, ScaleByMapSize(numof_industry_table[difficulty]));
}