* Calculate the number of towns which should be on the map according to the current "town density" newgame setting and the map size. * If the number of towns is set to "custom", the function will always return that value instead. * @return The number of towns. */
| 2430 | * @return The number of towns. |
| 2431 | */ |
| 2432 | uint GetDefaultTownsForMapSize() |
| 2433 | { |
| 2434 | static const uint8_t num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, normal, high |
| 2435 | if (_settings_game.difficulty.number_towns == static_cast<uint>(CUSTOM_TOWN_NUMBER_DIFFICULTY)) { |
| 2436 | return _settings_newgame.game_creation.custom_town_number; |
| 2437 | } |
| 2438 | return Map::ScaleBySize(num_initial_towns[_settings_game.difficulty.number_towns]); |
| 2439 | } |
| 2440 | |
| 2441 | /** |
| 2442 | * Generate a number of towns with a given layout. |
no outgoing calls
no test coverage detected