summaryrefslogtreecommitdiff
path: root/src/genworld_gui.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/genworld_gui.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/genworld_gui.cpp')
-rw-r--r--src/genworld_gui.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 49b8bc633..fd9346c8f 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -25,6 +25,7 @@
#include "core/random_func.hpp"
#include "landscape_type.h"
#include "querystring_gui.h"
+#include "town.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -285,7 +286,7 @@ static const StringID _smoothness[] = {STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_
static const StringID _tree_placer[] = {STR_CONFIG_SETTING_TREE_PLACER_NONE, STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL, STR_CONFIG_SETTING_TREE_PLACER_IMPROVED, INVALID_STRING_ID};
static const StringID _rotation[] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID};
static const StringID _landscape[] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID};
-static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
+static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, STR_02BF_CUSTOM, INVALID_STRING_ID};
static const StringID _num_inds[] = {STR_NONE, STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
struct GenerateLandscapeWindow : public QueryStringBaseWindow {
@@ -571,6 +572,11 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case GLAND_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break;
case GLAND_TOWN_PULLDOWN:
+ if (index == CUSTOM_TOWN_NUMBER_DIFFICULTY) {
+ this->widget_id = widget;
+ SetDParam(0, _settings_newgame.game_creation.custom_town_number);
+ ShowQueryString(STR_CONFIG_SETTING_INT32, STR_NUMBER_OF_TOWNS, 5, 50, this, CS_NUMERAL, QSF_NONE);
+ };
IConsoleSetSetting("difficulty.number_towns", index);
break;
@@ -621,6 +627,10 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
this->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT);
_settings_newgame.game_creation.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT);
break;
+
+ case GLAND_TOWN_PULLDOWN:
+ _settings_newgame.game_creation.custom_town_number = Clamp(value, 1, CUSTOM_TOWN_MAX_NUMBER);
+ break;
}
this->SetDirty();