annotate src/genworld_gui.cpp @ 15238:1cfb0b93d2c6 draft

(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
author yexo <yexo@openttd.org>
date Fri, 21 May 2010 08:23:46 +0000
parents ee05ac91d67f
children 821c26b30fd9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1 /* $Id$ */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2
12778
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
3 /*
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
4 * This file is part of OpenTTD.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
8 */
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 12739
diff changeset
9
9111
d48433370037 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents: 8749
diff changeset
10 /** @file genworld_gui.cpp GUI to configure and show progress during map generation. */
6179
e3e61b92574b (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents: 5901
diff changeset
11
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
12 #include "stdafx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
13 #include "openttd.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
14 #include "heightmap.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
15 #include "variables.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
16 #include "debug.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
17 #include "genworld.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
18 #include "network/network.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
19 #include "newgrf_config.h"
8114
2d6af5d7a142 (svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents: 8108
diff changeset
20 #include "strings_func.h"
8131
e300ac8001ae (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents: 8121
diff changeset
21 #include "window_func.h"
8140
fb8a05d579da (svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents: 8131
diff changeset
22 #include "date_func.h"
8157
019833e42fda (svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium <rubidium@openttd.org>
parents: 8151
diff changeset
23 #include "sound_func.h"
8151
bee108a98a39 (svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas <belugas@openttd.org>
parents: 8140
diff changeset
24 #include "fios.h"
8214
6385dffc0b37 (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium <rubidium@openttd.org>
parents: 8208
diff changeset
25 #include "string_func.h"
8327
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
26 #include "widgets/dropdown_type.h"
8284
dbb7bfe0e95c (svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138 <peter1138@openttd.org>
parents: 8270
diff changeset
27 #include "widgets/dropdown_func.h"
9126
8c450e1754e2 (svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers.
rubidium <rubidium@openttd.org>
parents: 9116
diff changeset
28 #include "landscape_type.h"
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
29 #include "querystring_gui.h"
11345
c78d659d5029 (svn r15695) -Feature [FS#2672]: Allow the number of towns that will be generated in the generate world window to be customized.
belugas <belugas@openttd.org>
parents: 11223
diff changeset
30 #include "town.h"
12849
b72fd8020fa5 (svn r17339) -Codechange: move thread related files to their own directory (like done for video, music, sound, etc)
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
31 #include "thread/thread.h"
12037
88adebc150dc (svn r16444) -Codechange: Set all company settings to their default value for a new company instead of zeroing them.
yexo <yexo@openttd.org>
parents: 11830
diff changeset
32 #include "settings_func.h"
14258
a899d4e5ee1a (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents: 14236
diff changeset
33 #include "core/geometry_func.hpp"
a899d4e5ee1a (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents: 14236
diff changeset
34 #include "core/random_func.hpp"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
35
8264
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
36 #include "table/strings.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
37 #include "table/sprites.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
38
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
39 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
40 * In what 'mode' the GenerateLandscapeWindowProc is.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
41 */
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
42 enum GenenerateLandscapeWindowMode {
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
43 GLWM_GENERATE, ///< Generate new game
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
44 GLWM_HEIGHTMAP, ///< Load from heightmap
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
45 GLWM_SCENARIO, ///< Generate flat land
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
46 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
47
11223
4928ebb36453 (svn r15576) -Codechange: rename SwitchModes to SwitchMode and don't hardcode the values for that enum.
yexo <yexo@openttd.org>
parents: 11222
diff changeset
48 extern void SwitchToMode(SwitchMode new_mode);
10696
7edccbb67398 (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents: 10592
diff changeset
49 extern void MakeNewgameSettingsLive();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
50
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
51 /**
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
52 * Changes landscape type and sets genworld window dirty
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
53 * @param landscape new landscape type
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
54 */
15237
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
55 void SetNewLandscapeType(byte landscape)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
56 {
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
57 _settings_newgame.game_creation.landscape = landscape;
15237
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
58 InvalidateWindowClassesData(WC_SELECT_GAME);
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
59 InvalidateWindowClassesData(WC_GENERATE_LANDSCAPE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
60 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
61
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
62 /** Widgets of GenerateLandscapeWindow */
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
63 enum GenerateLandscapeWindowWidgets {
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
64 GLAND_TEMPERATE, ///< Button with icon "Temperate"
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
65 GLAND_ARCTIC, ///< Button with icon "Arctic"
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
66 GLAND_TROPICAL, ///< Button with icon "Tropical"
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
67 GLAND_TOYLAND, ///< Button with icon "Toyland"
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
68
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
69 GLAND_MAPSIZE_X_PULLDOWN, ///< Dropdown 'map X size'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
70 GLAND_MAPSIZE_Y_PULLDOWN, ///< Dropdown 'map Y size'
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
71
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
72 GLAND_TOWN_PULLDOWN, ///< Dropdown 'No. of towns'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
73 GLAND_INDUSTRY_PULLDOWN, ///< Dropdown 'No. of industries'
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
74
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
75 GLAND_RANDOM_EDITBOX, ///< 'Random seed' editbox
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
76 GLAND_RANDOM_BUTTON, ///< 'Randomise' button
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
77
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
78 GLAND_GENERATE_BUTTON, ///< 'Generate' button
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
79
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
80 GLAND_START_DATE_DOWN, ///< Decrease start year
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
81 GLAND_START_DATE_TEXT, ///< Start year
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
82 GLAND_START_DATE_UP, ///< Increase start year
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
83
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
84 GLAND_SNOW_LEVEL_DOWN, ///< Docrease snow level
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
85 GLAND_SNOW_LEVEL_TEXT, ///< Snow level
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
86 GLAND_SNOW_LEVEL_UP, ///< Increase snow level
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
87
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
88 GLAND_TREE_PULLDOWN, ///< Dropdown 'Tree algorithm'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
89 GLAND_LANDSCAPE_PULLDOWN, ///< Dropdown 'Land generator'
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
90
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
91 GLAND_HEIGHTMAP_NAME_TEXT, ///< Heightmap name
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
92 GLAND_HEIGHTMAP_NAME_SPACER, ///< Spacer used for aligning items in the second column nicely
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
93 GLAND_HEIGHTMAP_SIZE_TEXT, ///< Size of heightmap
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
94 GLAND_HEIGHTMAP_ROTATION_PULLDOWN, ///< Dropdown 'Heightmap rotation'
10877
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
95
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
96 GLAND_TERRAIN_PULLDOWN, ///< Dropdown 'Terrain type'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
97 GLAND_WATER_PULLDOWN, ///< Dropdown 'Sea level'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
98 GLAND_SMOOTHNESS_PULLDOWN, ///< Dropdown 'Smoothness'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
99 GLAND_VARIETY_PULLDOWN, ///< Dropdown 'Variety distribution'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
100
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
101 GLAND_BORDERS_RANDOM, ///< 'Random'/'Manual' borders
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
102 GLAND_WATER_NW, ///< NW 'Water'/'Freeform'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
103 GLAND_WATER_NE, ///< NE 'Water'/'Freeform'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
104 GLAND_WATER_SE, ///< SE 'Water'/'Freeform'
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
105 GLAND_WATER_SW, ///< SW 'Water'/'Freeform'
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
106 };
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
107
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
108 /** Widgets of GenerateLandscapeWindow when generating world */
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
109 static const NWidgetPart _nested_generate_landscape_widgets[] = {
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
110 NWidget(NWID_HORIZONTAL),
13752
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
111 NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
112 NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MAPGEN_WORLD_GENERATION_CAPTION, STR_NULL),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
113 EndContainer(),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
114 NWidget(WWT_PANEL, COLOUR_BROWN),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
115 NWidget(NWID_SPACER), SetMinimalSize(0, 10),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
116 /* Landscape selection. */
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
117 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
118 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
119 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
120 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
121 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
122 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
123 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
124 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
125 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
126 NWidget(NWID_SPACER), SetFill(1, 0),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
127 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
128 NWidget(NWID_SPACER), SetMinimalSize(0, 11),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
129 NWidget(NWID_HORIZONTAL), SetPIP(10, 5, 10),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
130 NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
131 /* Left column with labels. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
132 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
133 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
134 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_LAND_GENERATOR, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
135 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
136 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TERRAIN_TYPE, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
137 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_RANDOM_SEED, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
138 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_SEA_LAKES, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
139 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
13999
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
140 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1),
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
141 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
142 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
143 /* Widgets at the right of the labels. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
144 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
145 /* Mapsize X * Y. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
146 NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
147 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
148 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
149 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
150 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
151 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
152 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
153 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
154 NWidget(WWT_EDITBOX, COLOUR_WHITE, GLAND_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
155 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
156 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
13999
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
157 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
158 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_BORDERS_RANDOM), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
159 EndContainer(),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
160 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
161 NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
162 NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
163 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
164 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
165 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
166 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
167 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SMOOTHNESS, STR_NULL), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
168 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
169 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
170 /* Starting date. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
171 NWidget(NWID_HORIZONTAL),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
172 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
173 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
174 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
175 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
176 /* Snow line. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
177 NWidget(NWID_HORIZONTAL),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
178 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
179 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
180 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
181 EndContainer(),
14236
18fdf6e9ba5b (svn r18787) -Fix [FS#3516]: crash when getting the tooltip of the industry amount in the world generation window
rubidium <rubidium@openttd.org>
parents: 14096
diff changeset
182 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
183 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_SMOOTHNESS_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
184 EndContainer(),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
185 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
186 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
187 NWidget(NWID_SPACER), SetFill(1, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
188 NWidget(WWT_TEXTBTN, COLOUR_GREEN, GLAND_GENERATE_BUTTON), SetMinimalSize(84, 30), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 0),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
189 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
190 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
191 NWidget(NWID_SPACER), SetMinimalSize(0, 4),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
192 /* Map borders buttons for each edge. */
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
193 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
194 NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 3),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
195 NWidget(NWID_SPACER), SetFill(1, 1),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
196 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
197 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
198 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_NW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHWEST), SetFill(1, 1),
13925
edc2ddd3cdc3 (svn r18457) -Fix (r18015): southwest and northeast buttons for freeform edges were swapped
yexo <yexo@openttd.org>
parents: 13922
diff changeset
199 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_NE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHEAST), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
200 NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
201 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NORTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
202 NWidget(NWID_SPACER), SetFill(1, 1),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
203 EndContainer(),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
204 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
205 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 0, 10),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
206 NWidget(NWID_HORIZONTAL), SetPIP(0, 0, 3),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
207 NWidget(NWID_SPACER), SetFill(1, 1),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
208 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHWEST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
209 EndContainer(),
13925
edc2ddd3cdc3 (svn r18457) -Fix (r18015): southwest and northeast buttons for freeform edges were swapped
yexo <yexo@openttd.org>
parents: 13922
diff changeset
210 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_SW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHWEST), SetFill(1, 1),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
211 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, GLAND_WATER_SE), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHEAST), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
212 NWidget(NWID_HORIZONTAL), SetPIP(3, 0, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
213 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SOUTHEAST, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(0, 1),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
214 NWidget(NWID_SPACER), SetFill(1, 1),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
215 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
216 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
217 NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetFill(1, 1),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
218 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
219 };
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
220
14309
9c8decad5dfe (svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents: 14307
diff changeset
221 /** Widgets of GenerateLandscapeWindow when loading heightmap */
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
222 static const NWidgetPart _nested_heightmap_load_widgets[] = {
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
223 /* Window header. */
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
224 NWidget(NWID_HORIZONTAL),
13752
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
225 NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
226 NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MAPGEN_WORLD_GENERATION_CAPTION, STR_NULL),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
227 EndContainer(),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
228 NWidget(WWT_PANEL, COLOUR_BROWN),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
229 NWidget(NWID_SPACER), SetMinimalSize(0, 10),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
230 /* Landscape selection. */
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
231 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
232 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
233 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
234 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
235 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
236 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
237 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
238 NWidget(NWID_SPACER), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
239 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, GLAND_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
240 NWidget(NWID_SPACER), SetFill(1, 0),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
241 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
242 NWidget(NWID_SPACER), SetMinimalSize(0, 11), SetFill(0, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
243 NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
244 /* Labels at the left side. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
245 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
246 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_NAME, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
247 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
248 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_TOWNS, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
249 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_NUMBER_OF_INDUSTRIES, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
250 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_RANDOM_SEED, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
251 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_TREE_PLACER, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
252 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_ROTATION, STR_NULL), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
253 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
254 /* Widgets at the right of the labels. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
255 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
256 NWidget(WWT_EMPTY, COLOUR_ORANGE, GLAND_HEIGHTMAP_NAME_TEXT), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
257 /* Mapsize X * Y. */
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
258 NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
259 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
260 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
261 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
262 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
263 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
264 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
265 NWidget(WWT_EDITBOX, COLOUR_WHITE, GLAND_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
266 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
267 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, GLAND_HEIGHTMAP_ROTATION_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
268 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
269 NWidget(NWID_VERTICAL), SetPIP(0, 4, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
270 NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
271 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
272 NWidget(WWT_EMPTY, INVALID_COLOUR, GLAND_HEIGHTMAP_NAME_SPACER), SetFill(1, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
273 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE_LABEL, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
274 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1),
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
275 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
276 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
277 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
278 NWidget(WWT_EMPTY, INVALID_COLOUR, GLAND_HEIGHTMAP_NAME_SPACER), SetFill(1, 0),
13922
3595acd28189 (svn r18453) -Fix [FS#3364]: wrong heightmap dimensions, or rather... a nested_array index removed too much
rubidium <rubidium@openttd.org>
parents: 13798
diff changeset
279 NWidget(WWT_TEXT, COLOUR_ORANGE, GLAND_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
280 NWidget(NWID_HORIZONTAL),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
281 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
282 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
283 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
284 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
285 NWidget(NWID_HORIZONTAL),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
286 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
287 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
288 NWidget(WWT_IMGBTN, COLOUR_ORANGE, GLAND_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
289 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
290 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
291 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
292 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, GLAND_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
293 NWidget(WWT_TEXTBTN, COLOUR_GREEN, GLAND_GENERATE_BUTTON), SetDataTip(STR_MAPGEN_GENERATE, STR_NULL), SetFill(1, 1),
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
294 EndContainer(),
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
295 EndContainer(),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
296 NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetFill(1, 1),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
297 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
298 };
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
299
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
300 static void StartGeneratingLandscape(GenenerateLandscapeWindowMode mode)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
301 {
5899
71bc001a6dde (svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents: 5894
diff changeset
302 DeleteAllNonVitalWindows();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
303
11148
3cb2d503c4e8 (svn r15495) -Revert (r15383,r15422): Loading NewGRFs depends on correct settings, but the economy can only be started after loading NewGRFs. In short: r15383 causes more problems then it's worth.
yexo <yexo@openttd.org>
parents: 11081
diff changeset
304 /* Copy all XXX_newgame to XXX when coming from outside the editor */
3cb2d503c4e8 (svn r15495) -Revert (r15383,r15422): Loading NewGRFs depends on correct settings, but the economy can only be started after loading NewGRFs. In short: r15383 causes more problems then it's worth.
yexo <yexo@openttd.org>
parents: 11081
diff changeset
305 MakeNewgameSettingsLive();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
306 ResetGRFConfig(true);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
307
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
308 SndPlayFx(SND_15_BEEP);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
309 switch (mode) {
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
310 case GLWM_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break;
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
311 case GLWM_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break;
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
312 case GLWM_SCENARIO: _switch_mode = SM_EDITOR; break;
5894
c4ab8176e02e (svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater <Darkvater@openttd.org>
parents: 5893
diff changeset
313 default: NOT_REACHED();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
314 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
315 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
316
6571
6777295c2328 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas <belugas@openttd.org>
parents: 6560
diff changeset
317 static void LandscapeGenerationCallback(Window *w, bool confirmed)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
318 {
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
319 if (confirmed) StartGeneratingLandscape((GenenerateLandscapeWindowMode)w->window_number);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
320 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
321
8327
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
322 static DropDownList *BuildMapsizeDropDown()
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
323 {
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
324 DropDownList *list = new DropDownList();
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
325
12227
307cf47f1c3a (svn r16642) -Codechange: use map size limits enum at one more place
smatz <smatz@openttd.org>
parents: 12037
diff changeset
326 for (uint i = MIN_MAP_SIZE_BITS; i <= MAX_MAP_SIZE_BITS; i++) {
8327
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
327 DropDownListParamStringItem *item = new DropDownListParamStringItem(STR_JUST_INT, i, false);
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
328 item->SetParam(0, 1 << i);
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
329 list->push_back(item);
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
330 }
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
331
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
332 return list;
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
333 }
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
334
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11561
diff changeset
335 static const StringID _elevations[] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, INVALID_STRING_ID};
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11561
diff changeset
336 static const StringID _sea_lakes[] = {STR_SEA_LEVEL_VERY_LOW, STR_SEA_LEVEL_LOW, STR_SEA_LEVEL_MEDIUM, STR_SEA_LEVEL_HIGH, INVALID_STRING_ID};
11069
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 11043
diff changeset
337 static const StringID _smoothness[] = {STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH, INVALID_STRING_ID};
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 11043
diff changeset
338 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};
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 11043
diff changeset
339 static const StringID _rotation[] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID};
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 11043
diff changeset
340 static const StringID _landscape[] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID};
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11561
diff changeset
341 static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM, INVALID_STRING_ID};
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11561
diff changeset
342 static const StringID _num_inds[] = {STR_NONE, STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, INVALID_STRING_ID};
14001
98cb52497428 (svn r18543) -Codechange: Use separate set of strings for variety distribution setting to ease translation.
peter1138 <peter1138@openttd.org>
parents: 13999
diff changeset
343 static const StringID _variety[] = {STR_VARIETY_NONE, STR_VARIETY_VERY_LOW, STR_VARIETY_LOW, STR_VARIETY_MEDIUM, STR_VARIETY_HIGH, STR_VARIETY_VERY_HIGH, INVALID_STRING_ID};
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
344
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
345 struct GenerateLandscapeWindow : public QueryStringBaseWindow {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
346 uint widget_id;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
347 uint x;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
348 uint y;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
349 char name[64];
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
350 GenenerateLandscapeWindowMode mode;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
351
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
352 GenerateLandscapeWindow(const WindowDesc *desc, WindowNumber number = 0) : QueryStringBaseWindow(11)
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
353 {
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
354 this->InitNested(desc, number);
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
355
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
356 this->LowerWidget(_settings_newgame.game_creation.landscape + GLAND_TEMPERATE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
357
10276
a5286e772120 (svn r14514) -Codechange: use 'size' instead of 'length' for querystring and textbuf, explicitly say it includes the terminating zero
smatz <smatz@openttd.org>
parents: 10180
diff changeset
358 /* snprintf() always outputs trailing '\0', so whole buffer can be used */
9897
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9648
diff changeset
359 snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed);
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9648
diff changeset
360 InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120);
11081
0a26df8849a2 (svn r15424) -Codechange: make it possible to have multiple windows with edit box open simultaniously (Zuu).
rubidium <rubidium@openttd.org>
parents: 11069
diff changeset
361 this->SetFocusedWidget(GLAND_RANDOM_EDITBOX);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
362 this->caption = STR_NULL;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
363 this->afilter = CS_NUMERAL;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
364
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
365 this->mode = (GenenerateLandscapeWindowMode)this->window_number;
15237
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
366
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
367 /* Disable town, industry and trees in SE */
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
368 this->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
369 this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
370 this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
371
15237
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
372 this->OnInvalidateData();
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
373 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
374
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
375
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
376 virtual void SetStringParameters(int widget) const
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
377 {
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
378 switch (widget) {
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
379 case GLAND_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
380 case GLAND_MAPSIZE_X_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_x); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
381 case GLAND_MAPSIZE_Y_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_y); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
382 case GLAND_SNOW_LEVEL_TEXT: SetDParam(0, _settings_newgame.game_creation.snow_line_height); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
383 case GLAND_TOWN_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_DISASTERS_OFF : _num_towns[_settings_newgame.difficulty.number_towns]); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
384 case GLAND_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_DISASTERS_OFF : _num_inds[_settings_newgame.difficulty.number_industries]); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
385 case GLAND_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
386 case GLAND_TREE_PULLDOWN: SetDParam(0, _tree_placer[_settings_newgame.game_creation.tree_placer]); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
387 case GLAND_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
388 case GLAND_WATER_PULLDOWN: SetDParam(0, _sea_lakes[_settings_newgame.difficulty.quantity_sea_lakes]); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
389 case GLAND_SMOOTHNESS_PULLDOWN: SetDParam(0, _smoothness[_settings_newgame.game_creation.tgen_smoothness]); break;
13999
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
390 case GLAND_VARIETY_PULLDOWN: SetDParam(0, _variety[_settings_newgame.game_creation.variety]); break;
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
391 case GLAND_BORDERS_RANDOM: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOMIZE : STR_MAPGEN_BORDER_MANUAL); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
392 case GLAND_WATER_NE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
393 case GLAND_WATER_NW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
394 case GLAND_WATER_SE: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
395 case GLAND_WATER_SW: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOM : HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW) ? STR_MAPGEN_BORDER_WATER : STR_MAPGEN_BORDER_FREEFORM); break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
396 case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: SetDParam(0, _rotation[_settings_newgame.game_creation.heightmap_rotation]); break;
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
397
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
398 case GLAND_HEIGHTMAP_SIZE_TEXT:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
399 if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
400 SetDParam(0, this->y);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
401 SetDParam(1, this->x);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
402 } else {
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
403 SetDParam(0, this->x);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
404 SetDParam(1, this->y);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
405 }
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
406 break;
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
407 }
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
408 }
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
409
15237
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
410 virtual void OnInvalidateData(int data = 0)
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
411 {
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
412 /* Update the climate buttons */
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
413 this->SetWidgetLoweredState(GLAND_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
414 this->SetWidgetLoweredState(GLAND_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
415 this->SetWidgetLoweredState(GLAND_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC);
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
416 this->SetWidgetLoweredState(GLAND_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
417
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
418 /* You can't select smoothness / non-water borders if not terragenesis */
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
419 if (mode == GLWM_GENERATE) {
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
420 this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
421 this->SetWidgetDisabledState(GLAND_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
422 this->SetWidgetDisabledState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
423 this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM,
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
424 GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE, GLAND_WATER_SW, WIDGET_LIST_END);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
425
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
426 this->SetWidgetLoweredState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
427
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
428 this->SetWidgetLoweredState(GLAND_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW));
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
429 this->SetWidgetLoweredState(GLAND_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE));
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
430 this->SetWidgetLoweredState(GLAND_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE));
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
431 this->SetWidgetLoweredState(GLAND_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW));
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
432
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
433 this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC),
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
434 GLAND_TERRAIN_PULLDOWN, GLAND_WATER_PULLDOWN, WIDGET_LIST_END);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
435 }
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
436
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
437 /* Disable snowline if not arctic */
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
438 this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
439
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
440 /* Update availability of decreasing / increasing start date and snow level */
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
441 this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
442 this->SetWidgetDisabledState(GLAND_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
443 this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
444 this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
15237
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
445 }
ee05ac91d67f (svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents: 14409
diff changeset
446
13705
8dee47e001b2 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents: 13704
diff changeset
447 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
448 {
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
449 const StringID *strs = NULL;
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
450 switch (widget) {
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
451 case GLAND_START_DATE_TEXT:
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
452 SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
453 *size = GetStringBoundingBox(STR_BLACK_DATE_LONG);
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
454 break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
455
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
456 case GLAND_MAPSIZE_X_PULLDOWN:
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
457 case GLAND_MAPSIZE_Y_PULLDOWN:
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
458 SetDParam(0, MAX_MAP_SIZE);
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
459 *size = GetStringBoundingBox(STR_JUST_INT);
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
460 break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
461
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
462 case GLAND_SNOW_LEVEL_TEXT:
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
463 SetDParam(0, MAX_TILE_HEIGHT);
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
464 *size = GetStringBoundingBox(STR_JUST_INT);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
465 break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
466
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
467 case GLAND_HEIGHTMAP_SIZE_TEXT:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
468 SetDParam(0, this->x);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
469 SetDParam(1, this->y);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
470 *size = GetStringBoundingBox(STR_MAPGEN_HEIGHTMAP_SIZE);
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
471 break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
472
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
473 case GLAND_TOWN_PULLDOWN: strs = _num_towns; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
474 case GLAND_INDUSTRY_PULLDOWN: strs = _num_inds; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
475 case GLAND_LANDSCAPE_PULLDOWN: strs = _landscape; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
476 case GLAND_TREE_PULLDOWN: strs = _tree_placer; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
477 case GLAND_TERRAIN_PULLDOWN: strs = _elevations; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
478 case GLAND_WATER_PULLDOWN: strs = _sea_lakes; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
479 case GLAND_SMOOTHNESS_PULLDOWN: strs = _smoothness; break;
13999
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
480 case GLAND_VARIETY_PULLDOWN: strs = _variety; break;
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
481 case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: strs = _rotation; break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
482 case GLAND_BORDERS_RANDOM:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
483 *size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOMIZE), GetStringBoundingBox(STR_MAPGEN_BORDER_MANUAL));
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
484 break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
485
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
486 case GLAND_WATER_NE:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
487 case GLAND_WATER_NW:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
488 case GLAND_WATER_SE:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
489 case GLAND_WATER_SW:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
490 *size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOM), maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_WATER), GetStringBoundingBox(STR_MAPGEN_BORDER_FREEFORM)));
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
491 break;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
492
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
493 case GLAND_HEIGHTMAP_NAME_SPACER:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
494 case GLAND_HEIGHTMAP_NAME_TEXT:
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
495 size->width = 0;
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
496 break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
497
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
498 default:
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
499 return;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
500 }
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
501 if (strs != NULL) {
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
502 while (*strs != INVALID_STRING_ID) {
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
503 *size = maxdim(*size, GetStringBoundingBox(*strs++));
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
504 }
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
505 }
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
506 size->width += padding.width;
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
507 size->height = FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM;
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
508 }
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
509
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
510 virtual void DrawWidget(const Rect &r, int widget) const
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
511 {
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
512 switch (widget) {
13589
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
513 case GLAND_HEIGHTMAP_NAME_TEXT: {
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
514 /* Little bit of a hack going on here; just to get the widgets
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
515 * spaced without doing much magic. The space we can draw on is
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
516 * covered by both the spacer and text widgets, so take their
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
517 * outer most boundaries (left and right) as draw locations. */
13695
75560523443c (svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents: 13628
diff changeset
518 const NWidgetBase *nwi_spacer = this->GetWidget<NWidgetBase>(GLAND_HEIGHTMAP_NAME_SPACER);
13589
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
519 DrawString(min(r.left, nwi_spacer->pos_x), max<int>(r.right, nwi_spacer->pos_x + nwi_spacer->current_x), r.top, this->name, TC_ORANGE);
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
520 } break;
13496
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
521 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
522 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
523
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
524 virtual void OnPaint()
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
525 {
9273
72a6d2e60834 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents: 9266
diff changeset
526 this->DrawWidgets();
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
527 this->DrawEditBox(GLAND_RANDOM_EDITBOX);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
528 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
529
14409
1eaefde497fd (svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents: 14346
diff changeset
530 virtual void OnClick(Point pt, int widget, int click_count)
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
531 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
532 switch (widget) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
533 case GLAND_TEMPERATE:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
534 case GLAND_ARCTIC:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
535 case GLAND_TROPICAL:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
536 case GLAND_TOYLAND:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
537 SetNewLandscapeType(widget - GLAND_TEMPERATE);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
538 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
539
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
540 case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
541 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, GLAND_MAPSIZE_X_PULLDOWN);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
542 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
543
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
544 case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
545 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, GLAND_MAPSIZE_Y_PULLDOWN);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
546 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
547
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
548 case GLAND_TOWN_PULLDOWN: // Number of towns
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
549 ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, GLAND_TOWN_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
550 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
551
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
552 case GLAND_INDUSTRY_PULLDOWN: // Number of industries
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
553 ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.number_industries, GLAND_INDUSTRY_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
554 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
555
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
556 case GLAND_RANDOM_BUTTON: // Random seed
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
557 _settings_newgame.game_creation.generation_seed = InteractiveRandom();
9897
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9648
diff changeset
558 snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
559 UpdateTextBufferSize(&this->text);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
560 this->SetDirty();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
561 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
562
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
563 case GLAND_GENERATE_BUTTON: // Generate
11148
3cb2d503c4e8 (svn r15495) -Revert (r15383,r15422): Loading NewGRFs depends on correct settings, but the economy can only be started after loading NewGRFs. In short: r15383 causes more problems then it's worth.
yexo <yexo@openttd.org>
parents: 11081
diff changeset
564 MakeNewgameSettingsLive();
3cb2d503c4e8 (svn r15495) -Revert (r15383,r15422): Loading NewGRFs depends on correct settings, but the economy can only be started after loading NewGRFs. In short: r15383 causes more problems then it's worth.
yexo <yexo@openttd.org>
parents: 11081
diff changeset
565
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
566 if (mode == GLWM_HEIGHTMAP &&
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
567 (this->x * 2 < (1U << _settings_newgame.game_creation.map_x) ||
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
568 this->x / 2 > (1U << _settings_newgame.game_creation.map_x) ||
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
569 this->y * 2 < (1U << _settings_newgame.game_creation.map_y) ||
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
570 this->y / 2 > (1U << _settings_newgame.game_creation.map_y))) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
571 ShowQuery(
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
572 STR_WARNING_HEIGHTMAP_SCALE_CAPTION,
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
573 STR_WARNING_HEIGHTMAP_SCALE_MESSAGE,
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
574 this,
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
575 LandscapeGenerationCallback);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
576 } else {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
577 StartGeneratingLandscape(mode);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
578 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
579 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
580
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
581 case GLAND_START_DATE_DOWN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
582 case GLAND_START_DATE_UP: // Year buttons
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
583 /* Don't allow too fast scrolling */
10180
e024f1d28082 (svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents: 10145
diff changeset
584 if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
585 this->HandleButtonClick(widget);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
586
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
587 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
588 this->InvalidateData();
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
589 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
590 _left_button_clicked = false;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
591 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
592
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
593 case GLAND_START_DATE_TEXT: // Year text
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
594 this->widget_id = GLAND_START_DATE_TEXT;
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
595 SetDParam(0, _settings_newgame.game_creation.starting_year);
14346
a279cef76b51 (svn r18901) -Change: make the default button work again for the world generation window; previously it worked due to the bug fixed in r18899. Do not add it again for the town custom number because there is no default for that one.
rubidium <rubidium@openttd.org>
parents: 14341
diff changeset
596 ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
597 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
598
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
599 case GLAND_SNOW_LEVEL_DOWN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
600 case GLAND_SNOW_LEVEL_UP: // Snow line buttons
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
601 /* Don't allow too fast scrolling */
10180
e024f1d28082 (svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents: 10145
diff changeset
602 if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
603 this->HandleButtonClick(widget);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
604
14042
61fc4da3a486 (svn r18585) -Codechange: replace some magic numbers by constants
rubidium <rubidium@openttd.org>
parents: 14018
diff changeset
605 _settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
606 this->InvalidateData();
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
607 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
608 _left_button_clicked = false;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
609 break;
8341
f43e029e9905 (svn r11907) -Codechange: clean up of worldgen/heightmap ui: replace many separate DrawString() calls with widgets, use dropdown widgets, and use consistent positioning/sizing.
peter1138 <peter1138@openttd.org>
parents: 8327
diff changeset
610
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
611 case GLAND_SNOW_LEVEL_TEXT: // Snow line text
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
612 this->widget_id = GLAND_SNOW_LEVEL_TEXT;
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
613 SetDParam(0, _settings_newgame.game_creation.snow_line_height);
14346
a279cef76b51 (svn r18901) -Change: make the default button work again for the world generation window; previously it worked due to the bug fixed in r18899. Do not add it again for the town custom number because there is no default for that one.
rubidium <rubidium@openttd.org>
parents: 14341
diff changeset
614 ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL, QSF_ENABLE_DEFAULT);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
615 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
616
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
617 case GLAND_TREE_PULLDOWN: // Tree placer
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
618 ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, GLAND_TREE_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
619 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
620
13493
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
621 case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
622 ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0);
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
623 break;
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
624
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
625 case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: // Heightmap rotation
dec4ce746e13 (svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents: 13490
diff changeset
626 ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
627 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
628
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
629 case GLAND_TERRAIN_PULLDOWN: // Terrain type
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
630 ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, GLAND_TERRAIN_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
631 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
632
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
633 case GLAND_WATER_PULLDOWN: // Water quantity
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
634 ShowDropDownMenu(this, _sea_lakes, _settings_newgame.difficulty.quantity_sea_lakes, GLAND_WATER_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
635 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
636
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
637 case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
638 ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
639 break;
10855
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
640
13999
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
641 case GLAND_VARIETY_PULLDOWN: // Map variety
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
642 ShowDropDownMenu(this, _variety, _settings_newgame.game_creation.variety, GLAND_VARIETY_PULLDOWN, 0, 0);
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
643 break;
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
644
10877
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
645 /* Freetype map borders */
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
646 case GLAND_WATER_NW:
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
647 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NW);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
648 this->InvalidateData();
10877
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
649 break;
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
650
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
651 case GLAND_WATER_NE:
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
652 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NE);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
653 this->InvalidateData();
10877
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
654 break;
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
655
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
656 case GLAND_WATER_SE:
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
657 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SE);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
658 this->InvalidateData();
10877
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
659 break;
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
660
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
661 case GLAND_WATER_SW:
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
662 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SW);
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
663 this->InvalidateData();
10877
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
664 break;
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
665
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
666 case GLAND_BORDERS_RANDOM:
e9c95718d466 (svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents: 10855
diff changeset
667 _settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : BORDERS_RANDOM;
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
668 this->InvalidateData();
10855
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
669 break;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
670 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
671 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
672
12739
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
673 virtual void OnTimeout()
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
674 {
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
675 static const int raise_widgets[] = {GLAND_START_DATE_DOWN, GLAND_START_DATE_UP, GLAND_SNOW_LEVEL_UP, GLAND_SNOW_LEVEL_DOWN, WIDGET_LIST_END};
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
676 for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
677 if (this->IsWidgetLowered(*widget)) {
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
678 this->RaiseWidget(*widget);
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
679 this->SetWidgetDirty(*widget);
12739
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
680 }
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
681 }
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
682 }
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
683
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
684 virtual void OnMouseLoop()
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
685 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
686 this->HandleEditBox(GLAND_RANDOM_EDITBOX);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
687 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
688
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
689 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
690 {
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
691 EventState state;
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
692 this->HandleEditBoxKey(GLAND_RANDOM_EDITBOX, key, keycode, state);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
693 /* the seed is unsigned, therefore atoi cannot be used.
11361
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11347
diff changeset
694 * As UINT32_MAX is a 'magic' value (use random seed) it
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11347
diff changeset
695 * should not be possible to be entered into the input
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11347
diff changeset
696 * field; the generate seed button can be used instead. */
9605
9ea90d50b73c (svn r13647) -Codechange: replace MAX_UVALUE() for std types with the equivalent constant
skidd13 <skidd13@openttd.org>
parents: 9516
diff changeset
697 _settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), UINT32_MAX - 1);
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
698 return state;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
699 }
8341
f43e029e9905 (svn r11907) -Codechange: clean up of worldgen/heightmap ui: replace many separate DrawString() calls with widgets, use dropdown widgets, and use consistent positioning/sizing.
peter1138 <peter1138@openttd.org>
parents: 8327
diff changeset
700
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
701 virtual void OnDropdownSelect(int widget, int index)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
702 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
703 switch (widget) {
10855
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
704 case GLAND_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
705 case GLAND_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
706 case GLAND_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break;
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
707 case GLAND_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break;
13999
9d1494492b63 (svn r18541) -Feature: Additional map variety option for TGP landscape generator. Evolved from curve map idea from Zephyris.
peter1138 <peter1138@openttd.org>
parents: 13925
diff changeset
708 case GLAND_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break;
14096
fe83b1c9460b (svn r18643) -Fix [FS#3436]: rotation could not be changed for heightmaps
rubidium <rubidium@openttd.org>
parents: 14043
diff changeset
709 case GLAND_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index; break;
fe83b1c9460b (svn r18643) -Fix [FS#3436]: rotation could not be changed for heightmaps
rubidium <rubidium@openttd.org>
parents: 14043
diff changeset
710 case GLAND_HEIGHTMAP_ROTATION_PULLDOWN: _settings_newgame.game_creation.heightmap_rotation = index; break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
711
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
712 case GLAND_TOWN_PULLDOWN:
11347
8656dc2695e9 (svn r15697) -Fix (r15695): warning about comparing signed vs unsigned.
rubidium <rubidium@openttd.org>
parents: 11345
diff changeset
713 if ((uint)index == CUSTOM_TOWN_NUMBER_DIFFICULTY) {
11345
c78d659d5029 (svn r15695) -Feature [FS#2672]: Allow the number of towns that will be generated in the generate world window to be customized.
belugas <belugas@openttd.org>
parents: 11223
diff changeset
714 this->widget_id = widget;
c78d659d5029 (svn r15695) -Feature [FS#2672]: Allow the number of towns that will be generated in the generate world window to be customized.
belugas <belugas@openttd.org>
parents: 11223
diff changeset
715 SetDParam(0, _settings_newgame.game_creation.custom_town_number);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
716 ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_TOWNS, 5, 50, this, CS_NUMERAL, QSF_NONE);
11345
c78d659d5029 (svn r15695) -Feature [FS#2672]: Allow the number of towns that will be generated in the generate world window to be customized.
belugas <belugas@openttd.org>
parents: 11223
diff changeset
717 };
11185
ffeedd433485 (svn r15538) -Fix (r15334): The difficulty level wasn't set to custom when changing the amount of towns/industries from the newgame gui.
yexo <yexo@openttd.org>
parents: 11148
diff changeset
718 IConsoleSetSetting("difficulty.number_towns", index);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
719 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
720
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
721 case GLAND_INDUSTRY_PULLDOWN:
11185
ffeedd433485 (svn r15538) -Fix (r15334): The difficulty level wasn't set to custom when changing the amount of towns/industries from the newgame gui.
yexo <yexo@openttd.org>
parents: 11148
diff changeset
722 IConsoleSetSetting("difficulty.number_industries", index);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
723 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
724
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
725 case GLAND_TERRAIN_PULLDOWN: {
11222
d0328639d3a8 (svn r15575) -Codechange: Rename GameModes to GameMode and store _game_mode as GameMode instead of as byte.
yexo <yexo@openttd.org>
parents: 11220
diff changeset
726 GameMode old_gm = _game_mode;
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
727 _game_mode = GM_MENU;
11185
ffeedd433485 (svn r15538) -Fix (r15334): The difficulty level wasn't set to custom when changing the amount of towns/industries from the newgame gui.
yexo <yexo@openttd.org>
parents: 11148
diff changeset
728 IConsoleSetSetting("difficulty.terrain_type", index);
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
729 _game_mode = old_gm;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
730 break;
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
731 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
732
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
733 case GLAND_WATER_PULLDOWN: {
11222
d0328639d3a8 (svn r15575) -Codechange: Rename GameModes to GameMode and store _game_mode as GameMode instead of as byte.
yexo <yexo@openttd.org>
parents: 11220
diff changeset
734 GameMode old_gm = _game_mode;
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
735 _game_mode = GM_MENU;
11185
ffeedd433485 (svn r15538) -Fix (r15334): The difficulty level wasn't set to custom when changing the amount of towns/industries from the newgame gui.
yexo <yexo@openttd.org>
parents: 11148
diff changeset
736 IConsoleSetSetting("difficulty.quantity_sea_lakes", index);
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
737 _game_mode = old_gm;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
738 break;
11220
3f640ecc6b09 (svn r15573) -Fix (r15538): Terrain type and sea level couldn't be changed in the scenario editor.
yexo <yexo@openttd.org>
parents: 11185
diff changeset
739 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
740 }
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
741 this->InvalidateData();
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
742 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
743
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
744 virtual void OnQueryTextFinished(char *str)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
745 {
14341
a19feda8e58a (svn r18896) -Fix [FS#3558]: pressing cancel for the query windows of the world generation window caused the default to be set instead of no changes to the value
rubidium <rubidium@openttd.org>
parents: 14309
diff changeset
746 /* Was 'cancel' pressed? */
a19feda8e58a (svn r18896) -Fix [FS#3558]: pressing cancel for the query windows of the world generation window caused the default to be set instead of no changes to the value
rubidium <rubidium@openttd.org>
parents: 14309
diff changeset
747 if (str == NULL) return;
a19feda8e58a (svn r18896) -Fix [FS#3558]: pressing cancel for the query windows of the world generation window caused the default to be set instead of no changes to the value
rubidium <rubidium@openttd.org>
parents: 14309
diff changeset
748
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
749 int32 value;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
750 if (!StrEmpty(str)) {
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
751 value = atoi(str);
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
752 } else {
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
753 /* An empty string means revert to the default */
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
754 switch (this->widget_id) {
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
755 case GLAND_START_DATE_TEXT: value = DEF_START_YEAR; break;
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
756 case GLAND_SNOW_LEVEL_TEXT: value = DEF_SNOWLINE_HEIGHT; break;
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
757 default: NOT_REACHED();
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
758 }
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
759 }
8737
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8433
diff changeset
760
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
761 switch (this->widget_id) {
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
762 case GLAND_START_DATE_TEXT:
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
763 this->SetWidgetDirty(GLAND_START_DATE_TEXT);
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
764 _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
765 break;
11345
c78d659d5029 (svn r15695) -Feature [FS#2672]: Allow the number of towns that will be generated in the generate world window to be customized.
belugas <belugas@openttd.org>
parents: 11223
diff changeset
766
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
767 case GLAND_SNOW_LEVEL_TEXT:
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
768 this->SetWidgetDirty(GLAND_SNOW_LEVEL_TEXT);
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
769 _settings_newgame.game_creation.snow_line_height = Clamp(value, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
770 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
771
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
772 case GLAND_TOWN_PULLDOWN:
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
773 _settings_newgame.game_creation.custom_town_number = Clamp(value, 1, CUSTOM_TOWN_MAX_NUMBER);
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
774 break;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
775 }
14043
ac099bcf95d9 (svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents: 14042
diff changeset
776
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
777 this->InvalidateData();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
778 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
779 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
780
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
781 static const WindowDesc _generate_landscape_desc(
13798
6f820ae12bb3 (svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents: 13796
diff changeset
782 WDP_CENTER, 0, 0,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
783 WC_GENERATE_LANDSCAPE, WC_NONE,
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
784 0,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
785 _nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
786 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
787
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
788 static const WindowDesc _heightmap_load_desc(
13798
6f820ae12bb3 (svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents: 13796
diff changeset
789 WDP_CENTER, 0, 0,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
790 WC_GENERATE_LANDSCAPE, WC_NONE,
15238
1cfb0b93d2c6 (svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents: 15237
diff changeset
791 0,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
792 _nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
793 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
794
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
795 static void _ShowGenerateLandscape(GenenerateLandscapeWindowMode mode)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
796 {
7103
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
797 uint x = 0;
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
798 uint y = 0;
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
799
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
800 DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
801
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
802 /* Always give a new seed if not editor */
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
803 if (_game_mode != GM_EDITOR) _settings_newgame.game_creation.generation_seed = InteractiveRandom();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
804
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
805 if (mode == GLWM_HEIGHTMAP) {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
806 /* If the function returns negative, it means there was a problem loading the heightmap */
7103
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
807 if (!GetHeightmapDimensions(_file_to_saveload.name, &x, &y)) return;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
808 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
809
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
810 GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>((mode == GLWM_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc, mode);
7103
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
811
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
812 if (mode == GLWM_HEIGHTMAP) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
813 w->x = x;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
814 w->y = y;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
815 strecpy(w->name, _file_to_saveload.title, lastof(w->name));
7103
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
816 }
960e94818e5f (svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents: 7018
diff changeset
817
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
818 SetWindowDirty(WC_GENERATE_LANDSCAPE, mode);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
819 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
820
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
821 void ShowGenerateLandscape()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
822 {
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
823 _ShowGenerateLandscape(GLWM_GENERATE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
824 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
825
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
826 void ShowHeightmapLoad()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
827 {
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
828 _ShowGenerateLandscape(GLWM_HEIGHTMAP);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
829 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
830
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
831 void StartScenarioEditor()
5899
71bc001a6dde (svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents: 5894
diff changeset
832 {
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
833 StartGeneratingLandscape(GLWM_SCENARIO);
5899
71bc001a6dde (svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents: 5894
diff changeset
834 }
71bc001a6dde (svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents: 5894
diff changeset
835
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
836 void StartNewGameWithoutGUI(uint seed)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
837 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
838 /* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
839 _settings_newgame.game_creation.generation_seed = seed;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
840
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
841 StartGeneratingLandscape(GLWM_GENERATE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
842 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
843
11536
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
844 /** Widget numbers of the create scenario window. */
5892
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
845 enum CreateScenarioWindowWidgets {
11536
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
846 CSCEN_TEMPERATE, ///< Select temperate landscape style.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
847 CSCEN_ARCTIC, ///< Select arctic landscape style.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
848 CSCEN_TROPICAL, ///< Select tropical landscape style.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
849 CSCEN_TOYLAND, ///< Select toy-land landscape style.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
850 CSCEN_EMPTY_WORLD, ///< Generate an empty flat world.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
851 CSCEN_RANDOM_WORLD, ///< Generate random land button
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
852 CSCEN_MAPSIZE_X_PULLDOWN, ///< Pull-down arrow for x map size.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
853 CSCEN_MAPSIZE_Y_PULLDOWN, ///< Pull-down arrow for y map size.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
854 CSCEN_START_DATE_DOWN, ///< Decrease start year (start earlier).
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
855 CSCEN_START_DATE_TEXT, ///< Clickable start date value.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
856 CSCEN_START_DATE_UP, ///< Increase start year (start later).
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
857 CSCEN_FLAT_LAND_HEIGHT_DOWN, ///< Decrease flat land height.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
858 CSCEN_FLAT_LAND_HEIGHT_TEXT, ///< Clickable flat land height value.
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
859 CSCEN_FLAT_LAND_HEIGHT_UP ///< Increase flat land height.
5892
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
860 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
861
5894
c4ab8176e02e (svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater <Darkvater@openttd.org>
parents: 5893
diff changeset
862
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
863 struct CreateScenarioWindow : public Window
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
864 {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
865 uint widget_id;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
866
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
867 CreateScenarioWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
868 {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
869 this->InitNested(desc, window_number);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
870 this->LowerWidget(_settings_newgame.game_creation.landscape + CSCEN_TEMPERATE);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
871 }
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
872
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
873 virtual void SetStringParameters(int widget) const
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
874 {
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
875 switch (widget) {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
876 case CSCEN_START_DATE_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
877 SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
878 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
879
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
880 case CSCEN_MAPSIZE_X_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
881 SetDParam(0, 1 << _settings_newgame.game_creation.map_x);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
882 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
883
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
884 case CSCEN_MAPSIZE_Y_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
885 SetDParam(0, 1 << _settings_newgame.game_creation.map_y);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
886 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
887
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
888 case CSCEN_FLAT_LAND_HEIGHT_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
889 SetDParam(0, _settings_newgame.game_creation.se_flat_world_height);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
890 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
891 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
892 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
893
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
894 virtual void OnPaint()
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
895 {
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
896 this->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
897 this->SetWidgetDisabledState(CSCEN_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
898 this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0);
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
899 this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= MAX_TILE_HEIGHT);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
900
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
901 this->SetWidgetLoweredState(CSCEN_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
902 this->SetWidgetLoweredState(CSCEN_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC);
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
903 this->SetWidgetLoweredState(CSCEN_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC);
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
904 this->SetWidgetLoweredState(CSCEN_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
905
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
906 this->DrawWidgets();
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
907 }
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
908
13705
8dee47e001b2 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents: 13704
diff changeset
909 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
910 {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
911 StringID str = STR_JUST_INT;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
912 switch (widget) {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
913 case CSCEN_START_DATE_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
914 SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
915 str = STR_BLACK_DATE_LONG;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
916 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
917
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
918 case CSCEN_MAPSIZE_X_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
919 case CSCEN_MAPSIZE_Y_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
920 SetDParam(0, MAX_MAP_SIZE);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
921 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
922
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
923 case CSCEN_FLAT_LAND_HEIGHT_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
924 SetDParam(0, MAX_TILE_HEIGHT);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
925 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
926
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
927 default:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
928 return;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
929 }
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
930 *size = GetStringBoundingBox(str);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
931 size->width += padding.width;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
932 size->height += padding.height;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
933 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
934
14409
1eaefde497fd (svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents: 14346
diff changeset
935 virtual void OnClick(Point pt, int widget, int click_count)
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
936 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
937 switch (widget) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
938 case CSCEN_TEMPERATE:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
939 case CSCEN_ARCTIC:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
940 case CSCEN_TROPICAL:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
941 case CSCEN_TOYLAND:
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
942 this->RaiseWidget(_settings_newgame.game_creation.landscape + CSCEN_TEMPERATE);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
943 SetNewLandscapeType(widget - CSCEN_TEMPERATE);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
944 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
945
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
946 case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
947 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, CSCEN_MAPSIZE_X_PULLDOWN);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
948 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
949
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
950 case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
951 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, CSCEN_MAPSIZE_Y_PULLDOWN);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
952 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
953
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
954 case CSCEN_EMPTY_WORLD: // Empty world / flat world
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
955 StartGeneratingLandscape(GLWM_SCENARIO);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
956 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
957
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
958 case CSCEN_RANDOM_WORLD: // Generate
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
959 ShowGenerateLandscape();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
960 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
961
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
962 case CSCEN_START_DATE_DOWN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
963 case CSCEN_START_DATE_UP: // Year buttons
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
964 /* Don't allow too fast scrolling */
10180
e024f1d28082 (svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents: 10145
diff changeset
965 if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
966 this->HandleButtonClick(widget);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
967 this->SetDirty();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
968
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
969 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
970 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
971 _left_button_clicked = false;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
972 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
973
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
974 case CSCEN_START_DATE_TEXT: // Year text
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
975 this->widget_id = CSCEN_START_DATE_TEXT;
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
976 SetDParam(0, _settings_newgame.game_creation.starting_year);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
977 ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_NONE);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
978 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
979
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
980 case CSCEN_FLAT_LAND_HEIGHT_DOWN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
981 case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
982 /* Don't allow too fast scrolling */
10180
e024f1d28082 (svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents: 10145
diff changeset
983 if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
984 this->HandleButtonClick(widget);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
985 this->SetDirty();
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
986
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
987 _settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
988 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
989 _left_button_clicked = false;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
990 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
991
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
992 case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
993 this->widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT;
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
994 SetDParam(0, _settings_newgame.game_creation.se_flat_world_height);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
995 ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL, QSF_NONE);
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
996 break;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
997 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
998 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
999
13585
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1000 virtual void OnTimeout()
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1001 {
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1002 static const int raise_widgets[] = {CSCEN_START_DATE_DOWN, CSCEN_START_DATE_UP, CSCEN_FLAT_LAND_HEIGHT_DOWN, CSCEN_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END};
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1003 for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1004 if (this->IsWidgetLowered(*widget)) {
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1005 this->RaiseWidget(*widget);
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1006 this->SetWidgetDirty(*widget);
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1007 }
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1008 }
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1009 }
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
1010
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1011 virtual void OnDropdownSelect(int widget, int index)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1012 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1013 switch (widget) {
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
1014 case CSCEN_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
1015 case CSCEN_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1016 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1017 this->SetDirty();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1018 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1019
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1020 virtual void OnQueryTextFinished(char *str)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1021 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1022 if (!StrEmpty(str)) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1023 int32 value = atoi(str);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1024
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1025 switch (this->widget_id) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1026 case CSCEN_START_DATE_TEXT:
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
1027 this->SetWidgetDirty(CSCEN_START_DATE_TEXT);
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
1028 _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1029 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1030
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1031 case CSCEN_FLAT_LAND_HEIGHT_TEXT:
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
1032 this->SetWidgetDirty(CSCEN_FLAT_LAND_HEIGHT_TEXT);
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
1033 _settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1034 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1035 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1036
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1037 this->SetDirty();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1038 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1039 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
1040 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1041
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1042 static const NWidgetPart _nested_create_scenario_widgets[] = {
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1043 NWidget(NWID_HORIZONTAL),
13752
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
1044 NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
1045 NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_SE_MAPGEN_CAPTION, STR_NULL),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1046 EndContainer(),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
1047 NWidget(WWT_PANEL, COLOUR_BROWN),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1048 NWidget(NWID_SPACER), SetMinimalSize(0, 10),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1049 /* Landscape style selection. */
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1050 NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10),
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1051 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1052 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1053 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1054 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, CSCEN_TOYLAND), SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1055 EndContainer(),
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1056 NWidget(NWID_HORIZONTAL), SetPIP(10, 8, 10),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1057 /* Green generation type buttons: 'Flat land' and 'Random land'. */
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1058 NWidget(NWID_VERTICAL), SetPIP(10, 6, 10),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1059 NWidget(WWT_TEXTBTN, COLOUR_GREEN, CSCEN_EMPTY_WORLD), SetDataTip(STR_SE_MAPGEN_FLAT_WORLD, STR_SE_MAPGEN_FLAT_WORLD_TOOLTIP), SetFill(1, 1),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1060 NWidget(WWT_TEXTBTN, COLOUR_GREEN, CSCEN_RANDOM_WORLD), SetDataTip(STR_SE_MAPGEN_RANDOM_LAND, STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND), SetFill(1, 1),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1061 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1062 /* Labels + setting drop-downs */
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1063 NWidget(NWID_VERTICAL), SetPIP(10, 6, 10),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1064 /* Map size. */
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1065 NWidget(NWID_HORIZONTAL),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
1066 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_NULL), SetPadding(1, 0, 0, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1067 NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0),
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1068 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, CSCEN_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetPadding(0, 4, 0, 0),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
1069 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 2, 0, 0),
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1070 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, CSCEN_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1071 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1072 /* Date. */
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1073 NWidget(NWID_HORIZONTAL),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
1074 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetPadding(1, 0, 0, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1075 NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1076 NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_START_DATE_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD),
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1077 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, CSCEN_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1078 NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_START_DATE_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1079 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1080 /* Flat map height. */
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1081 NWidget(NWID_HORIZONTAL),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
1082 NWidget(WWT_TEXT, COLOUR_ORANGE),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
1083 SetDataTip(STR_SE_MAPGEN_FLAT_WORLD_HEIGHT, STR_NULL), SetPadding(1, 0, 0, 0),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1084 NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1085 NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_FLAT_LAND_HEIGHT_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_DOWN),
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1086 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, CSCEN_FLAT_LAND_HEIGHT_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1087 NWidget(WWT_IMGBTN, COLOUR_ORANGE, CSCEN_FLAT_LAND_HEIGHT_UP), SetFill(0, 1), SetDataTip(SPR_ARROW_UP, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_UP),
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1088 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1089 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1090 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1091 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1092 };
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1093
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
1094 static const WindowDesc _create_scenario_desc(
13798
6f820ae12bb3 (svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents: 13796
diff changeset
1095 WDP_CENTER, 0, 0,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
1096 WC_GENERATE_LANDSCAPE, WC_NONE,
13749
fc3ab8256c95 (svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents: 13705
diff changeset
1097 WDF_UNCLICK_BUTTONS,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
1098 _nested_create_scenario_widgets, lengthof(_nested_create_scenario_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
1099 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1100
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
1101 void ShowCreateScenario()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1102 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1103 DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
14307
f0ad75f914d1 (svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents: 14301
diff changeset
1104 new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1105 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1106
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1107 enum GenerationProgressWindowWidgets {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1108 GPWW_PROGRESS_BAR,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1109 GPWW_PROGRESS_TEXT,
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1110 GPWW_ABORT,
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1111 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1112
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1113 static const NWidgetPart _nested_generate_progress_widgets[] = {
13752
517d77f53919 (svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents: 13749
diff changeset
1114 NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GENERATION_WORLD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
13755
bf8a4ced15fe (svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents: 13752
diff changeset
1115 NWidget(WWT_PANEL, COLOUR_GREY),
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1116 NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20),
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1117 NWidget(NWID_VERTICAL), SetPIP(11, 8, 11),
13704
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1118 NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_BAR), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1119 NWidget(WWT_EMPTY, INVALID_COLOUR, GPWW_PROGRESS_TEXT), SetFill(1, 0),
af90d4bf0785 (svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents: 13695
diff changeset
1120 NWidget(WWT_TEXTBTN, COLOUR_WHITE, GPWW_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0),
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1121 EndContainer(),
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1122 EndContainer(),
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1123 EndContainer(),
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1124 };
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1125
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1126
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
1127 static const WindowDesc _generate_progress_desc(
13798
6f820ae12bb3 (svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents: 13796
diff changeset
1128 WDP_CENTER, 0, 0,
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1129 WC_GENERATE_PROGRESS_WINDOW, WC_NONE,
13749
fc3ab8256c95 (svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents: 13705
diff changeset
1130 WDF_UNCLICK_BUTTONS,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
1131 _nested_generate_progress_widgets, lengthof(_nested_generate_progress_widgets)
11373
474ba6cc0946 (svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents: 11361
diff changeset
1132 );
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1133
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1134 struct GenWorldStatus {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1135 uint percent;
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
1136 StringID cls;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1137 uint current;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1138 uint total;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1139 int timer;
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
1140 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1141
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1142 static GenWorldStatus _gws;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1143
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1144 static const StringID _generation_class_table[] = {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1145 STR_GENERATION_WORLD_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1146 STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1147 STR_GENERATION_CLEARING_TILES,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1148 STR_SCENEDIT_TOOLBAR_TOWN_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1149 STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1150 STR_GENERATION_UNMOVABLE_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1151 STR_GENERATION_TREE_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1152 STR_GENERATION_SETTINGUP_GAME,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1153 STR_GENERATION_PREPARING_TILELOOP,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1154 STR_GENERATION_PREPARING_GAME
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1155 };
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1156 assert_compile(lengthof(_generation_class_table) == GWP_CLASS_COUNT);
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1157
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1158
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1159 static void AbortGeneratingWorldCallback(Window *w, bool confirmed)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1160 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1161 if (confirmed) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1162 AbortGeneratingWorld();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1163 } else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) {
5668
3d6d9bff3dd8 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138 <peter1138@openttd.org>
parents: 5587
diff changeset
1164 SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1165 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1166 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1167
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1168 struct GenerateProgressWindow : public Window {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1169
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1170 GenerateProgressWindow() : Window()
9333
5236ba6c7d54 (svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents: 9317
diff changeset
1171 {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1172 this->InitNested(&_generate_progress_desc);
9333
5236ba6c7d54 (svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents: 9317
diff changeset
1173 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1174
14409
1eaefde497fd (svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents: 14346
diff changeset
1175 virtual void OnClick(Point pt, int widget, int click_count)
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1176 {
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1177 switch (widget) {
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1178 case GPWW_ABORT:
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1179 if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1180 ShowQuery(
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1181 STR_GENERATION_ABORT_CAPTION,
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1182 STR_GENERATION_ABORT_MESSAGE,
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1183 this,
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1184 AbortGeneratingWorldCallback
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1185 );
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1186 break;
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1187 }
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1188 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1189
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1190 virtual void OnPaint()
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1191 {
9273
72a6d2e60834 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents: 9266
diff changeset
1192 this->DrawWidgets();
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1193 }
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1194
13705
8dee47e001b2 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents: 13704
diff changeset
1195 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1196 {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1197 switch (widget) {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1198 case GPWW_PROGRESS_BAR: {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1199 SetDParam(0, 100);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1200 *size = GetStringBoundingBox(STR_GENERATION_PROGRESS);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1201 /* We need some spacing for the 'border' */
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1202 size->height += 8;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1203 size->width += 8;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1204 } break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1205
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1206 case GPWW_PROGRESS_TEXT:
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1207 for (uint i = 0; i < GWP_CLASS_COUNT; i++) {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1208 size->width = max(size->width, GetStringBoundingBox(_generation_class_table[i]).width);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1209 }
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1210 size->height = FONT_HEIGHT_NORMAL * 2 + WD_PAR_VSEP_NORMAL;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1211 break;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1212 }
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1213 }
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1214
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1215 virtual void DrawWidget(const Rect &r, int widget) const
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1216 {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1217 switch (widget) {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1218 case GPWW_PROGRESS_BAR:
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1219 /* Draw the % complete with a bar and a text */
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1220 DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY);
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1221 DrawFrameRect(r.left + 1, r.top + 1, (int)((r.right - r.left - 2) * _gws.percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE);
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1222 SetDParam(0, _gws.percent);
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1223 DrawString(r.left, r.right, r.top + 5, STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_CENTER);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1224 break;
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1225
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1226 case GPWW_PROGRESS_TEXT:
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1227 /* Tell which class we are generating */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1228 DrawString(r.left, r.right, r.top, _gws.cls, TC_FROMSTRING, SA_CENTER);
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1229
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1230 /* And say where we are in that class */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1231 SetDParam(0, _gws.current);
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1232 SetDParam(1, _gws.total);
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1233 DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL, STR_GENERATION_PROGRESS_NUM, TC_FROMSTRING, SA_CENTER);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1234 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1235 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1236 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1237
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1238 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1239 * Initializes the progress counters to the starting point.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1240 */
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
1241 void PrepareGenerateWorldProgress()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1242 {
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1243 _gws.cls = STR_GENERATION_WORLD_GENERATION;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1244 _gws.current = 0;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1245 _gws.total = 0;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1246 _gws.percent = 0;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1247 _gws.timer = 0; // Forces to paint the progress window immediatelly
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1248 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1249
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1250 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1251 * Show the window where a user can follow the process of the map generation.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1252 */
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
1253 void ShowGenerateWorldProgress()
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1254 {
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1255 if (BringWindowToFrontById(WC_GENERATE_PROGRESS_WINDOW, 0)) return;
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1256 new GenerateProgressWindow();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1257 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1258
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1259 static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uint total)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1260 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1261 static const int percent_table[GWP_CLASS_COUNT + 1] = {0, 5, 15, 20, 40, 60, 65, 80, 85, 99, 100 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1262
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
1263 assert(cls < GWP_CLASS_COUNT);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1264
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1265 /* Do not run this function if we aren't in a thread */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1266 if (!IsGenerateWorldThreaded() && !_network_dedicated) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1267
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1268 if (IsGeneratingWorldAborted()) HandleGeneratingWorldAbortion();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1269
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1270 if (total == 0) {
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1271 assert(_gws.cls == _generation_class_table[cls]);
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1272 _gws.current += progress;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1273 assert(_gws.current <= _gws.total);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1274 } else {
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1275 _gws.cls = _generation_class_table[cls];
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1276 _gws.current = progress;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1277 _gws.total = total;
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1278 _gws.percent = percent_table[cls];
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1279 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1280
11830
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1281 /* Don't update the screen too often. So update it once in every once in a while... */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1282 if (!_network_dedicated && _gws.timer != 0 && _realtime_tick - _gws.timer < GENWORLD_REDRAW_TIMEOUT) return;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1283
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1284 /* Percentage is about the number of completed tasks, so 'current - 1' */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1285 _gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1286
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1287 if (_network_dedicated) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1288 static uint last_percent = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1289
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1290 /* Never display 0% */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1291 if (_gws.percent == 0) return;
9950
dbf95da604b3 (svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents: 9910
diff changeset
1292 /* Reset if percent is lower than the last recorded */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1293 if (_gws.percent < last_percent) last_percent = 0;
9950
dbf95da604b3 (svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents: 9910
diff changeset
1294 /* Display every 5%, but 6% is also very valid.. just not smaller steps than 5% */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1295 if (_gws.percent % 5 != 0 && _gws.percent <= last_percent + 5) return;
9950
dbf95da604b3 (svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents: 9910
diff changeset
1296 /* Never show steps smaller than 2%, even if it is a mod 5% */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1297 if (_gws.percent <= last_percent + 2) return;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1298
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1299 DEBUG(net, 1, "Map generation percentage complete: %d", _gws.percent);
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1300 last_percent = _gws.percent;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1301
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1302 /* Don't continue as dedicated never has a thread running */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1303 return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1304 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1305
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
1306 SetWindowDirty(WC_GENERATE_PROGRESS_WINDOW, 0);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1307 MarkWholeScreenDirty();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1308
11830
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1309 /* Release the rights to the map generator, and acquire the rights to the
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1310 * paint thread. The 'other' thread already has the paint thread rights so
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1311 * this ensures us that we are waiting until the paint thread is done
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1312 * before we reacquire the mapgen rights */
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1313 _genworld_mapgen_mutex->EndCritical();
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1314 _genworld_paint_mutex->BeginCritical();
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1315 _genworld_mapgen_mutex->BeginCritical();
c6abfb5a42bd (svn r16220) -Fix [FS#2862]: possible crashes when quiting OpenTTD or forcing resizes/redraws of the screen during map generation
rubidium <rubidium@openttd.org>
parents: 11773
diff changeset
1316 _genworld_paint_mutex->EndCritical();
7123
b89905ec574e (svn r10396) -Fix: When landscape generating, allow for 200ms between screen updates instead of updating every 200ms. Previously slow screen updates would result in very slow map generation (GeekToo)
peter1138 <peter1138@openttd.org>
parents: 7103
diff changeset
1317
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1318 _gws.timer = _realtime_tick;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1319 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1320
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1321 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1322 * Set the total of a stage of the world generation.
6481
85a1a79387a2 (svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas <belugas@openttd.org>
parents: 6357
diff changeset
1323 * @param cls the current class we are in.
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1324 * @param total Set the total expected items for this class.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1325 *
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1326 * Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1327 * Also, progress works if total is zero, total works if progress is zero.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1328 */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1329 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1330 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1331 if (total == 0) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1332
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
1333 _SetGeneratingWorldProgress(cls, 0, total);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1334 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1335
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1336 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1337 * Increases the current stage of the world generation with one.
6481
85a1a79387a2 (svn r9662) -Documentation: Doxygen corrections and @file omissions
belugas <belugas@openttd.org>
parents: 6357
diff changeset
1338 * @param cls the current class we are in.
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1339 *
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1340 * Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1341 * Also, progress works if total is zero, total works if progress is zero.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1342 */
14301
70d2b51a40ae (svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents: 14298
diff changeset
1343 void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1344 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1345 /* In fact the param 'class' isn't needed.. but for some security reasons, we want it around */
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
1346 _SetGeneratingWorldProgress(cls, 1, 0);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1347 }