* Get wanted number of industries on the map. * @return Wanted number of industries at the map. */
| 2355 | * @return Wanted number of industries at the map. |
| 2356 | */ |
| 2357 | static uint GetNumberOfIndustries() |
| 2358 | { |
| 2359 | /* Number of industries on a 256x256 map. */ |
| 2360 | static const uint16_t numof_industry_table[] = { |
| 2361 | 0, // none |
| 2362 | 0, // minimal |
| 2363 | 10, // very low |
| 2364 | 25, // low |
| 2365 | 55, // normal |
| 2366 | 80, // high |
| 2367 | 0, // custom |
| 2368 | }; |
| 2369 | |
| 2370 | assert(lengthof(numof_industry_table) == ID_END); |
| 2371 | uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.industry_density : (uint)ID_VERY_LOW; |
| 2372 | |
| 2373 | if (difficulty == ID_CUSTOM) return std::min<uint>(IndustryPool::MAX_SIZE, _settings_game.game_creation.custom_industry_number); |
| 2374 | |
| 2375 | return std::min<uint>(IndustryPool::MAX_SIZE, Map::ScaleBySize(numof_industry_table[difficulty])); |
| 2376 | } |
| 2377 | |
| 2378 | /** |
| 2379 | * Try to place the industry in the game. |
no outgoing calls
no test coverage detected