summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2009-03-12 23:54:20 +0000
committerbelugas <belugas@openttd.org>2009-03-12 23:54:20 +0000
commitf6e4bc765ae9a69e3e0622724c6859d5b315c4af (patch)
treefa98a505935dda8630df645a1ed2db85cd425e43 /src/town_cmd.cpp
parentaf18469455ff19d223ba7e7114f42041fb35aab7 (diff)
downloadopenttd-f6e4bc765ae9a69e3e0622724c6859d5b315c4af.tar.xz
(svn r15695) -Feature [FS#2672]: Allow the number of towns that will be generated in the generate world window to be customized.
Some warnings: -the maximum number of towns to be accepted is set to 5000 -the minimum number of towns to be accepted is set to 1 -the number that is specified is NOT guaranteed to be the exact number of towns generated. The normal mechanism of town creation has not been modified. So town placement can still fail. -setting a custom number of town will change your difficulty settings to custom as well
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index f656fe76b..a4a47522c 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1633,7 +1633,8 @@ static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, no
bool GenerateTowns(TownLayout layout)
{
uint num = 0;
- uint n = ScaleByMapSize(_num_initial_towns[_settings_game.difficulty.number_towns] + (Random() & 7));
+ uint difficulty = _settings_game.difficulty.number_towns;
+ uint n = difficulty == CUSTOM_TOWN_NUMBER_DIFFICULTY ? _settings_game.game_creation.custom_town_number : ScaleByMapSize(_num_initial_towns[difficulty] + (Random() & 7));
uint num_cities = _settings_game.economy.larger_towns == 0 ? 0 : n / _settings_game.economy.larger_towns;
SetGeneratingWorldProgress(GWP_TOWN, n);