Allow specifying a custom number of industries in map generation window

This commit is contained in:
Jonathan G Rennison
2021-12-08 17:33:32 +00:00
parent b807f0d50e
commit b69521ea87
4 changed files with 48 additions and 5 deletions

View File

@@ -2284,10 +2284,12 @@ 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]));
}