annotate src/genworld_gui.cpp @ 14258:a899d4e5ee1a draft

(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
author rubidium <rubidium@openttd.org>
date Fri, 15 Jan 2010 16:41:15 +0000
parents 18fdf6e9ba5b
children 35244bbcc585
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 */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
42 enum glwp_modes {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
43 GLWP_GENERATE,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
44 GLWP_HEIGHTMAP,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
45 GLWP_SCENARIO,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
46 GLWP_END
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
47 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
48
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
49 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
50 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
51
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
52 static inline void SetNewLandscapeType(byte landscape)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
53 {
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
54 _settings_newgame.game_creation.landscape = landscape;
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
55 SetWindowClassesDirty(WC_SELECT_GAME);
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
56 SetWindowClassesDirty(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
57 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
58
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
59 enum GenerateLandscapeWindowWidgets {
11543
8b0fe56a5b44 (svn r15906) -Codechange: Completed widget number enum of world-generation windows.
alberth <alberth@openttd.org>
parents: 11538
diff changeset
60 GLAND_TEMPERATE,
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
61 GLAND_ARCTIC,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
62 GLAND_TROPICAL,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
63 GLAND_TOYLAND,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
64
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
65 GLAND_MAPSIZE_X_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
66 GLAND_MAPSIZE_Y_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
67
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
68 GLAND_TOWN_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
69 GLAND_INDUSTRY_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
70
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
71 GLAND_RANDOM_EDITBOX,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
72 GLAND_RANDOM_BUTTON,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
73
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
74 GLAND_GENERATE_BUTTON,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
75
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
76 GLAND_START_DATE_DOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
77 GLAND_START_DATE_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
78 GLAND_START_DATE_UP,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
79
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
80 GLAND_SNOW_LEVEL_DOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
81 GLAND_SNOW_LEVEL_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
82 GLAND_SNOW_LEVEL_UP,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
83
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
84 GLAND_TREE_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
85 GLAND_LANDSCAPE_PULLDOWN,
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
86 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
87 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
88 GLAND_HEIGHTMAP_SIZE_TEXT,
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
89 GLAND_HEIGHTMAP_ROTATION_PULLDOWN,
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
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
91 GLAND_TERRAIN_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
92 GLAND_WATER_PULLDOWN,
10855
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
93 GLAND_SMOOTHNESS_PULLDOWN,
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
94 GLAND_VARIETY_PULLDOWN,
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
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
96 GLAND_BORDER_TYPES,
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
97 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
98 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
99 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
100 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
101 GLAND_WATER_SW,
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
102 };
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
103
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
104 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
105 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
106 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
107 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
108 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
109 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
110 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
111 /* 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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120 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
121 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
122 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
123 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
124 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
125 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
126 /* 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
127 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
128 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
129 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
130 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
131 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
132 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
133 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
134 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
135 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), 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
136 NWidget(WWT_TEXT, COLOUR_ORANGE, GLAND_BORDER_TYPES), 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
137 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
138 /* 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
139 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
140 /* 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 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
150 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
151 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
152 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
153 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
154 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
155 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
156 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
157 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
158 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
159 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
160 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
161 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
162 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
163 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
164 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
165 /* 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
166 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
167 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
168 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
169 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
170 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
171 /* 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
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179 EndContainer(),
11561
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
180 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
181 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
182 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
183 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
184 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
185 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
186 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
187 /* 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 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
196 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
197 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
198 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
199 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
200 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
201 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
202 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
203 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
204 EndContainer(),
13925
edc2ddd3cdc3 (svn r18457) -Fix (r18015): southwest and northeast buttons for freeform edges were swapped
yexo <yexo@openttd.org>
parents: 13922
diff changeset
205 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
206 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
207 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
208 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
209 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
210 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
211 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
212 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
213 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
214 };
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
215
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
216 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
217 /* Window header. */
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
218 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
219 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
220 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
221 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
222 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
223 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
224 /* 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
225 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
226 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
227 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
228 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
229 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
230 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
231 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
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_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
234 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
235 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
236 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
237 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
238 /* 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
239 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
240 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
241 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
242 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
243 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
244 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
245 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
246 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
247 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
248 /* 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
249 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
250 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
251 /* 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
252 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
253 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
254 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
255 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
256 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
257 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
258 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
259 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
260 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
261 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
262 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
263 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
264 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
265 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
266 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
267 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
268 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
269 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
270 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
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),
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
273 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
274 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
275 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
276 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
277 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
278 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
279 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
280 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
281 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
282 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
283 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
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 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
286 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
287 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
288 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
289 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
290 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
291 EndContainer(),
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
292 };
0fcdcc728f43 (svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents: 11543
diff changeset
293
13509
59959bee9f95 (svn r18028) -Codechange: unglobalise some functions
rubidium <rubidium@openttd.org>
parents: 13496
diff changeset
294 static void StartGeneratingLandscape(glwp_modes 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
295 {
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
296 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
297
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
298 /* 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
299 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
300 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
301
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
302 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
303 switch (mode) {
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
304 case GLWP_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break;
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
305 case GLWP_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break;
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
306 case GLWP_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
307 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
308 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
309 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
310
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
311 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
312 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
313 if (confirmed) StartGeneratingLandscape((glwp_modes)w->window_number);
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
8327
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
316 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
317 {
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
318 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
319
12227
307cf47f1c3a (svn r16642) -Codechange: use map size limits enum at one more place
smatz <smatz@openttd.org>
parents: 12037
diff changeset
320 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
321 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
322 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
323 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
324 }
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
325
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
326 return list;
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
327 }
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
328
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
329 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
330 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
331 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
332 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
333 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
334 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
335 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
336 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
337 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
338
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
339 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
340 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
341 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
342 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
343 char name[64];
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 glwp_modes mode;
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
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
346 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
347 {
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
348 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
349
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
350 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
351
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
352 /* 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
353 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
354 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
355 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
356 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
357 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
358
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
359 this->mode = (glwp_modes)this->window_number;
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
360 }
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
361
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
362
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
363 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
364 {
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
365 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373 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
374 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
375 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
376 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
377 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
378 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
379 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
380 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
381 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
382 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
383 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
384
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
385 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
386 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
387 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
388 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
389 } 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
390 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
391 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
392 }
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
393 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
394 }
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 }
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
13705
8dee47e001b2 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents: 13704
diff changeset
397 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
398 {
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
399 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
400 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
401 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
402 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
403 *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
404 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
405
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
406 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
407 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
408 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
409 *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
410 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
411
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
412 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
413 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
414 *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
415 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
416
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
417 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
418 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
419 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
420 *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
421 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
422
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
423 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
424 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
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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
433 *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
434 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
435
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
436 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
437 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
438 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
439 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
440 *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
441 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
442
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
443 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
444 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
445 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
446 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
447
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 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
449 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
450 }
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
451 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
452 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
453 *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
454 }
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
455 }
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
456 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
457 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
458 }
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
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
460 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
461 {
8eae44ae8187 (svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents: 13493
diff changeset
462 switch (widget) {
13589
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
463 case GLAND_HEIGHTMAP_NAME_TEXT: {
a269ef5dd3fb (svn r18113) -Fix: RTL glitch in play heightmap window
rubidium <rubidium@openttd.org>
parents: 13585
diff changeset
464 /* 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
465 * 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
466 * 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
467 * 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
468 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
469 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
470 } 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
471 }
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
472 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
473
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
474 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
475 {
10855
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
476 /* You can't select smoothness / non-water borders if not terragenesis */
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
477 if (mode == GLWP_GENERATE) {
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
478 this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 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
479 this->SetWidgetDisabledState(GLAND_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
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
480 this->SetWidgetDisabledState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges);
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
481 this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == 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
482 GLAND_WATER_NW, GLAND_WATER_NE, GLAND_WATER_SE, GLAND_WATER_SW, WIDGET_LIST_END);
10905
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
483
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
484 this->SetWidgetLoweredState(GLAND_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM);
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
485
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
486 this->SetWidgetLoweredState(GLAND_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW));
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
487 this->SetWidgetLoweredState(GLAND_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE));
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
488 this->SetWidgetLoweredState(GLAND_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE));
1aa79a9da08e (svn r15240) -Fix (r15212): Loading heightmaps resulted in an assert.
Yexo <Yexo@openttd.org>
parents: 10877
diff changeset
489 this->SetWidgetLoweredState(GLAND_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW));
14017
1c7a698cbf86 (svn r18559) -Fix: When using original landscape generator, the terrain type and water level fields have no effect for arctic or tropic climates, so disable the dropdowns.
peter1138 <peter1138@openttd.org>
parents: 14001
diff changeset
490
1c7a698cbf86 (svn r18559) -Fix: When using original landscape generator, the terrain type and water level fields have no effect for arctic or tropic climates, so disable the dropdowns.
peter1138 <peter1138@openttd.org>
parents: 14001
diff changeset
491 this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC),
1c7a698cbf86 (svn r18559) -Fix: When using original landscape generator, the terrain type and water level fields have no effect for arctic or tropic climates, so disable the dropdowns.
peter1138 <peter1138@openttd.org>
parents: 14001
diff changeset
492 GLAND_TERRAIN_PULLDOWN, GLAND_WATER_PULLDOWN, WIDGET_LIST_END);
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
493 }
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
494 /* Disable snowline if not hilly */
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
495 this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC);
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
496 /* Disable town, industry and trees in SE */
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
497 this->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
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
498 this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
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
499 this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
500
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
501 this->SetWidgetDisabledState(GLAND_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
502 this->SetWidgetDisabledState(GLAND_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
14042
61fc4da3a486 (svn r18585) -Codechange: replace some magic numbers by constants
rubidium <rubidium@openttd.org>
parents: 14018
diff changeset
503 this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
504 this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
505
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
506 this->SetWidgetLoweredState(GLAND_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
507 this->SetWidgetLoweredState(GLAND_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
508 this->SetWidgetLoweredState(GLAND_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
509 this->SetWidgetLoweredState(GLAND_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
510
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
511 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
512
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
513 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
514 }
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
515
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
516 virtual void OnClick(Point pt, int 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
517 {
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
518 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
519 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
520 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
521 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
522 case GLAND_TOYLAND:
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
523 this->RaiseWidget(_settings_newgame.game_creation.landscape + GLAND_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
524 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
525 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
526
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 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
528 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
529 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
530
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 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
532 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
533 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
534
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_TOWN_PULLDOWN: // Number of towns
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
536 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
537 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
538
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
539 case GLAND_INDUSTRY_PULLDOWN: // Number of industries
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
540 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
541 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
542
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
543 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
544 _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
545 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
546 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
547 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
548 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
549
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 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
551 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
552
11000
def5dbb7e314 (svn r15340) -Fix [FS#2121]: changing town road layout in-game caused ugly road networks
smatz <smatz@openttd.org>
parents: 10960
diff changeset
553 if (mode == GLWP_HEIGHTMAP &&
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
554 (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
555 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
556 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
557 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
558 ShowQuery(
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
559 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
560 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
561 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
562 LandscapeGenerationCallback);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
563 } 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
564 StartGeneratingLandscape(mode);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
565 }
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
566 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
567
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
568 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
569 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
570 /* 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
571 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
572 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
573 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
574
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
575 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - GLAND_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
576 }
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 _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
578 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
579
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
580 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
581 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
582 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
583 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
584 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
585
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 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
587 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
588 /* 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
589 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
590 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
591 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
592
14042
61fc4da3a486 (svn r18585) -Codechange: replace some magic numbers by constants
rubidium <rubidium@openttd.org>
parents: 14018
diff changeset
593 _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);
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
594 }
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
595 _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
596 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
597
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
598 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
599 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
600 SetDParam(0, _settings_newgame.game_creation.snow_line_height);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
601 ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_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
602 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
603
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 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
605 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
606 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
607
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
608 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
609 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
610 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
611
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
612 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
613 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
614 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
615
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 case GLAND_TERRAIN_PULLDOWN: // Terrain type
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
617 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
618 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
619
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
620 case GLAND_WATER_PULLDOWN: // Water quantity
9358
12f4585b2124 (svn r13255) -Codechange: move _opt to _settings.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
621 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
622 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
623
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
624 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
625 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
626 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
627
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
628 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
629 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
630 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
631
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
632 /* 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
633 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
634 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_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
635 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
636
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
637 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
638 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_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
639 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
640
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
641 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
642 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_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
643 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
644
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 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
646 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_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
647 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
648
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 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
650 _settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : 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
651 this->SetDirty();
10855
7881d9cd55ab (svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents: 10784
diff changeset
652 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
653 }
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
654 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
655
12739
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
656 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
657 {
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
658 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
659 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
660 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
661 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
662 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
663 }
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
664 }
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
665 }
2d764711d51b (svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents: 12632
diff changeset
666
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
667 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
668 {
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
669 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
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
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
672 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
673 {
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
674 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
675 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
676 /* 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
677 * 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
678 * 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
679 * 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
680 _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
681 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
682 }
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
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 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
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 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
687 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
688 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
689 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
690 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
691 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
692 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
693 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
694
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
695 case GLAND_TOWN_PULLDOWN:
11347
8656dc2695e9 (svn r15697) -Fix (r15695): warning about comparing signed vs unsigned.
rubidium <rubidium@openttd.org>
parents: 11345
diff changeset
696 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
697 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
698 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
699 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
700 };
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
701 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
702 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
703
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
704 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
705 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
706 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
707
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
708 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
709 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
710 _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
711 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
712 _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
713 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
714 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
715
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
716 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
717 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
718 _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
719 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
720 _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
721 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
722 }
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 }
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
724 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
725 }
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
726
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
727 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
728 {
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
729 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
730 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
731 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
732 } 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
733 /* 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
734 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
735 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
736 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
737 case GLAND_TOWN_PULLDOWN: value = 1; break; // There's not really a default
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
738 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
739 }
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
740 }
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
741
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
742 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
743 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
744 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
745 _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
746 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
747
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
748 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
749 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
750 _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
751 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
752
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
753 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
754 _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
755 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
756 }
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
757
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 this->SetDirty();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
759 }
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
760 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
761
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
762 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
763 WDP_CENTER, 0, 0,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
764 WC_GENERATE_LANDSCAPE, WC_NONE,
13749
fc3ab8256c95 (svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents: 13705
diff changeset
765 WDF_UNCLICK_BUTTONS,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
766 _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
767 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
768
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
769 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
770 WDP_CENTER, 0, 0,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
771 WC_GENERATE_LANDSCAPE, WC_NONE,
13749
fc3ab8256c95 (svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents: 13705
diff changeset
772 WDF_UNCLICK_BUTTONS,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
773 _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
774 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
775
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
776 static void _ShowGenerateLandscape(glwp_modes mode)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
777 {
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
778 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
779 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
780
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
781 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
782
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
783 /* 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
784 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
785
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
786 if (mode == GLWP_HEIGHTMAP) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
787 /* 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
788 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
789 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
790
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
791 GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>((mode == GLWP_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
792
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
793 if (mode == GLWP_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
794 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
795 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
796 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
797 }
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
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
799 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
800 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
801
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
802 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
803 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
804 _ShowGenerateLandscape(GLWP_GENERATE);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
805 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
806
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
807 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
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 _ShowGenerateLandscape(GLWP_HEIGHTMAP);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
810 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
811
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
812 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
813 {
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
814 StartGeneratingLandscape(GLWP_SCENARIO);
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
815 }
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
816
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
817 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
818 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
819 /* 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
820 _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
821
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
822 StartGeneratingLandscape(GLWP_GENERATE);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
823 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
824
11536
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
825 /** 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
826 enum CreateScenarioWindowWidgets {
11536
549a7dca2526 (svn r15897) -Codechange: Completed widget numbers and comment of create-scenario window.
alberth <alberth@openttd.org>
parents: 11521
diff changeset
827 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
828 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
829 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
830 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
831 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
832 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
833 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
834 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
835 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
836 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
837 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
838 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
839 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
840 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
841 };
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
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
843
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
844 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
845 {
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
846 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
847
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
848 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
849 {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
850 this->InitNested(desc, window_number);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
851 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
852 }
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
853
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
854 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
855 {
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
856 switch (widget) {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
857 case CSCEN_START_DATE_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
858 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
859 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
860
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
861 case CSCEN_MAPSIZE_X_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
862 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
863 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
864
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
865 case CSCEN_MAPSIZE_Y_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
866 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
867 break;
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 case CSCEN_FLAT_LAND_HEIGHT_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
870 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
871 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
872 }
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
873 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
874
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
875 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
876 {
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
877 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
878 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
879 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
880 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
881
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
882 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
883 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
884 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
885 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
886
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
887 this->DrawWidgets();
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
888 }
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
889
13705
8dee47e001b2 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents: 13704
diff changeset
890 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
891 {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
892 StringID str = STR_JUST_INT;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
893 switch (widget) {
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
894 case CSCEN_START_DATE_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
895 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
896 str = STR_BLACK_DATE_LONG;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
897 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
898
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
899 case CSCEN_MAPSIZE_X_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
900 case CSCEN_MAPSIZE_Y_PULLDOWN:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
901 SetDParam(0, MAX_MAP_SIZE);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
902 break;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
903
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
904 case CSCEN_FLAT_LAND_HEIGHT_TEXT:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
905 SetDParam(0, MAX_TILE_HEIGHT);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
906 break;
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 default:
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
909 return;
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 *size = GetStringBoundingBox(str);
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
912 size->width += padding.width;
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
913 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
914 }
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
915
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
916 virtual void OnClick(Point pt, int 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
917 {
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
918 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
919 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
920 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
921 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
922 case CSCEN_TOYLAND:
9359
c3a0ec3104c9 (svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents: 9358
diff changeset
923 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
924 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
925 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
926
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
927 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
928 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
929 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
930
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
931 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
932 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
933 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
934
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
935 case CSCEN_EMPTY_WORLD: // Empty world / flat world
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 StartGeneratingLandscape(GLWP_SCENARIO);
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 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
938
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_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
940 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
941 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
942
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 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
944 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
945 /* 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
946 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
947 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
948 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
949
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
950 _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
951 }
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 _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
953 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
954
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
955 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
956 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
957 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
958 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
959 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
960
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
961 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
962 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
963 /* 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
964 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
965 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
966 this->SetDirty();
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
967
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
968 _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
969 }
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 _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
971 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
972
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
973 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
974 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
975 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
976 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
977 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
978 }
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 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
980
13585
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
981 virtual void OnTimeout()
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
982 {
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
983 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
984 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
985 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
986 this->RaiseWidget(*widget);
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
987 this->SetWidgetDirty(*widget);
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
988 }
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
989 }
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
990 }
2d12e2247813 (svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents: 13564
diff changeset
991
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
992 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
993 {
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
994 switch (widget) {
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9346
diff changeset
995 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
996 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
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 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
999 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1000
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
1001 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
1002 {
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
1003 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
1004 int32 value = atoi(str);
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1005
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
1006 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
1007 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
1008 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
1009 _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
1010 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1011
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
1012 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
1013 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
1014 _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
1015 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
1016 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1017
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
1018 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
1019 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1020 }
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
1021 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1022
11537
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1023 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
1024 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
1025 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
1026 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
1027 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
1028 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
1029 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
1030 /* Landscape style selection. */
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1031 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
1032 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
1033 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
1034 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
1035 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
1036 EndContainer(),
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1037 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
1038 /* 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
1039 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
1040 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
1041 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
1042 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1043 /* Labels + setting drop-downs */
13490
369cd73e98d3 (svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents: 13487
diff changeset
1044 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
1045 /* Map size. */
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1046 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
1047 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
1048 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
1049 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
1050 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
1051 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
1052 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1053 /* Date. */
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1054 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
1055 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
1056 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
1057 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
1058 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
1059 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
1060 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1061 /* Flat map height. */
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1062 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
1063 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
1064 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
1065 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
1066 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
1067 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
1068 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
1069 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1070 EndContainer(),
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 EndContainer(),
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1073 };
ed03b8609ef7 (svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents: 11536
diff changeset
1074
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
1075 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
1076 WDP_CENTER, 0, 0,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
1077 WC_GENERATE_LANDSCAPE, WC_NONE,
13749
fc3ab8256c95 (svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents: 13705
diff changeset
1078 WDF_UNCLICK_BUTTONS,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
1079 _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
1080 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1081
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
1082 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
1083 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1084 DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
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
1085 new CreateScenarioWindow(&_create_scenario_desc, GLWP_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
1086 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1087
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1088 enum GenerationProgressWindowWidgets {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1089 GPWW_PROGRESS_BAR,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1090 GPWW_PROGRESS_TEXT,
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1091 GPWW_ABORT,
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1092 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1093
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1094 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
1095 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
1096 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
1097 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
1098 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
1099 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
1100 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
1101 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
1102 EndContainer(),
11521
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1103 EndContainer(),
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1104 EndContainer(),
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1105 };
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1106
7a2bb2bb8fce (svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents: 11450
diff changeset
1107
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
1108 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
1109 WDP_CENTER, 0, 0,
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1110 WC_GENERATE_PROGRESS_WINDOW, WC_NONE,
13749
fc3ab8256c95 (svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents: 13705
diff changeset
1111 WDF_UNCLICK_BUTTONS,
13564
bae287664b02 (svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents: 13509
diff changeset
1112 _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
1113 );
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1114
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
1115 struct tp_info {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1116 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
1117 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
1118 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
1119 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
1120 int timer;
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
1121 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1122
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1123 static tp_info _tp;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1124
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1125 static const StringID _generation_class_table[GWP_CLASS_COUNT] = {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1126 STR_GENERATION_WORLD_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1127 STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1128 STR_GENERATION_CLEARING_TILES,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1129 STR_SCENEDIT_TOOLBAR_TOWN_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1130 STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1131 STR_GENERATION_UNMOVABLE_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1132 STR_GENERATION_TREE_GENERATION,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1133 STR_GENERATION_SETTINGUP_GAME,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1134 STR_GENERATION_PREPARING_TILELOOP,
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1135 STR_GENERATION_PREPARING_GAME
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1136 };
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1137
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1138
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1139 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
1140 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1141 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
1142 AbortGeneratingWorld();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1143 } 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
1144 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
1145 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1146 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1147
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1148 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
1149
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1150 GenerateProgressWindow() : Window()
9333
5236ba6c7d54 (svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents: 9317
diff changeset
1151 {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1152 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
1153 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1154
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1155 virtual void OnClick(Point pt, int widget)
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1156 {
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1157 switch (widget) {
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1158 case GPWW_ABORT:
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1159 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
1160 ShowQuery(
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1161 STR_GENERATION_ABORT_CAPTION,
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1162 STR_GENERATION_ABORT_MESSAGE,
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1163 this,
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1164 AbortGeneratingWorldCallback
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1165 );
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1166 break;
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1167 }
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1168 }
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
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1170 virtual void OnPaint()
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1171 {
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
1172 this->DrawWidgets();
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1173 }
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1174
13705
8dee47e001b2 (svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents: 13704
diff changeset
1175 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
1176 {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1177 switch (widget) {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1178 case GPWW_PROGRESS_BAR: {
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1179 SetDParam(0, 100);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1180 *size = GetStringBoundingBox(STR_GENERATION_PROGRESS);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1181 /* 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
1182 size->height += 8;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1183 size->width += 8;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1184 } 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
1185
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1186 case GPWW_PROGRESS_TEXT:
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1187 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
1188 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
1189 }
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1190 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
1191 break;
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1192 }
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
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1195 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
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 /* 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
1200 DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1201 DrawFrameRect(r.left + 1, r.top + 1, (int)((r.right - r.left - 2) * _tp.percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1202 SetDParam(0, _tp.percent);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1203 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
1204 break;
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
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 /* Tell which class we are generating */
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1208 DrawString(r.left, r.right, r.top, _tp.cls, TC_FROMSTRING, SA_CENTER);
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 /* And say where we are in that class */
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1211 SetDParam(0, _tp.current);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1212 SetDParam(1, _tp.total);
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1213 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
1214 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1215 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1216 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1217
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1218 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1219 * 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
1220 */
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
1221 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
1222 {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
1223 _tp.cls = STR_GENERATION_WORLD_GENERATION;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1224 _tp.current = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1225 _tp.total = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1226 _tp.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
1227 _tp.timer = 0; // Forces to paint the progress window immediatelly
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1228 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1229
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1230 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1231 * 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
1232 */
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
1233 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
1234 {
9266
3108515a123e (svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents: 9203
diff changeset
1235 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
1236 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
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
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
1239 static void _SetGeneratingWorldProgress(gwp_class 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
1240 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1241 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
1242
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
1243 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
1244
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1245 /* 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
1246 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
1247
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1248 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
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 if (total == 0) {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1251 assert(_tp.cls == _generation_class_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
1252 _tp.current += progress;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1253 } else {
13487
4ff75a36a676 (svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents: 13186
diff changeset
1254 _tp.cls = _generation_class_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
1255 _tp.current = progress;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1256 _tp.total = total;
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
1257 _tp.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
1258 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1259
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
1260 /* Don't update the screen too often. So update it once in every once in a while... */
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
1261 if (!_network_dedicated && _tp.timer != 0 && _realtime_tick - _tp.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
1262
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1263 /* Percentage is about the number of completed tasks, so 'current - 1' */
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
1264 _tp.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_tp.current == 0 ? 0 : _tp.current - 1) / _tp.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
1265
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 (_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
1267 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
1268
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1269 /* Never display 0% */
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 (_tp.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
1271 /* Reset if percent is lower than the last recorded */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1272 if (_tp.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
1273 /* Display every 5%, but 6% is also very valid.. just not smaller steps than 5% */
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 if (_tp.percent % 5 != 0 && _tp.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
1275 /* Never show steps smaller than 2%, even if it is a mod 5% */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1276 if (_tp.percent <= last_percent + 2) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1277
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1278 DEBUG(net, 1, "Map generation percentage complete: %d", _tp.percent);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1279 last_percent = _tp.percent;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1280
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1281 /* 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
1282 return;
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
13034
6eb3f749890a (svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents: 12849
diff changeset
1285 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
1286 MarkWholeScreenDirty();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1287
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
1288 /* 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
1289 * 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
1290 * 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
1291 * 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
1292 _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
1293 _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
1294 _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
1295 _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
1296
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
1297 _tp.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
1298 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1299
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1300 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1301 * 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
1302 * @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
1303 * @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
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 * 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
1306 * 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
1307 */
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
1308 void SetGeneratingWorldProgress(gwp_class 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
1309 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1310 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
1311
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
1312 _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
1313 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1314
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1315 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1316 * 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
1317 * @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
1318 *
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1319 * 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
1320 * 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
1321 */
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
1322 void IncreaseGeneratingWorldProgress(gwp_class 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
1323 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1324 /* 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
1325 _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
1326 }