Mercurial > hg > openttd
annotate src/genworld_gui.cpp @ 20706:79930f9362c3 draft
-Change: [Win32] Position the IME composition window at the caret position.
author | Michael Lutz <michi@icosahedron.de> |
---|---|
date | Sun, 07 Apr 2013 17:10:38 +0200 (2013-04-07) |
parents | 491ddf49f744 |
children |
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 "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
|
14 #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
|
15 #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
|
16 #include "network/network.h" |
8114
2d6af5d7a142
(svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents:
8108
diff
changeset
|
17 #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
|
18 #include "window_func.h" |
8140
fb8a05d579da
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents:
8131
diff
changeset
|
19 #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
|
20 #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
|
21 #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
|
22 #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
|
23 #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
|
24 #include "widgets/dropdown_func.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
|
25 #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
|
26 #include "town.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
|
27 #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
|
28 #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
|
29 #include "core/random_func.hpp" |
17979
5302cd55d676
(svn r22788) -Codechange: move modal progress related functions and variables to progress.cpp/h
rubidium <rubidium@openttd.org>
parents:
17978
diff
changeset
|
30 #include "progress.h" |
18628
718c69c25a56
(svn r23475) -Codechange: queue critical error messages, so when multiple happen you won't miss any
rubidium <rubidium@openttd.org>
parents:
18623
diff
changeset
|
31 #include "error.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
32 |
18680
e87c7c30e606
(svn r23528) -Codechange: move widget enums to widgets/NNN_type.h
truebrain <truebrain@openttd.org>
parents:
18677
diff
changeset
|
33 #include "widgets/genworld_widget.h" |
e87c7c30e606
(svn r23528) -Codechange: move widget enums to widgets/NNN_type.h
truebrain <truebrain@openttd.org>
parents:
18677
diff
changeset
|
34 |
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
|
35 |
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
|
36 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
|
37 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
38 /** Enum for the modes we can generate in. */ |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
39 enum GenenerateLandscapeWindowMode { |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
40 GLWM_GENERATE, ///< Generate new game. |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
41 GLWM_HEIGHTMAP, ///< Load from heightmap. |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
42 GLWM_SCENARIO, ///< Generate flat land. |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
43 }; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
44 |
14309
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
45 /** |
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
46 * Changes landscape type and sets genworld window dirty |
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
47 * @param landscape new landscape type |
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
48 */ |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
49 void SetNewLandscapeType(byte landscape) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
50 { |
9359
c3a0ec3104c9
(svn r13256) -Codechange: merge the OPTS and PATS chuncks.
rubidium <rubidium@openttd.org>
parents:
9358
diff
changeset
|
51 _settings_newgame.game_creation.landscape = landscape; |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
52 InvalidateWindowClassesData(WC_SELECT_GAME); |
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
53 InvalidateWindowClassesData(WC_GENERATE_LANDSCAPE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
54 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
55 |
14309
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
56 /** Widgets of GenerateLandscapeWindow when generating world */ |
11561
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 /* 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
|
65 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
|
66 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
67 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
68 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
69 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
70 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
71 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
72 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
73 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
74 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
|
75 EndContainer(), |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 /* 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
|
80 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), |
19993
b2a09fbdcbc8
(svn r24925) -Fix [FS#5395]: Add a tooltip to the mapsize selection mentioning possible deviations.
frosch <frosch@openttd.org>
parents:
19913
diff
changeset
|
81 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_MAPSIZE, STR_MAPGEN_MAPSIZE_TOOLTIP), 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 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
|
88 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_VARIETY, STR_NULL), SetFill(1, 1), |
14309
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
89 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BORDER_TYPE, STR_NULL), SetFill(1, 1), |
13496
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
90 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
|
91 /* 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
|
92 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
|
93 /* 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
|
94 NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0), |
19993
b2a09fbdcbc8
(svn r24925) -Fix [FS#5395]: Add a tooltip to the mapsize selection mentioning possible deviations.
frosch <frosch@openttd.org>
parents:
19913
diff
changeset
|
95 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), 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
|
96 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1), |
19993
b2a09fbdcbc8
(svn r24925) -Fix [FS#5395]: Add a tooltip to the mapsize selection mentioning possible deviations.
frosch <frosch@openttd.org>
parents:
19913
diff
changeset
|
97 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_MAPGEN_MAPSIZE_TOOLTIP), 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
|
98 EndContainer(), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
99 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_LANDSCAPE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
100 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
101 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TERRAIN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
19814
173b8706e0d6
(svn r24747) -Fix: Some editboxes had a different colour than the rest of the window.
frosch <frosch@openttd.org>
parents:
19809
diff
changeset
|
102 NWidget(WWT_EDITBOX, COLOUR_ORANGE, WID_GL_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
103 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_WATER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
104 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
105 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_VARIETY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
106 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_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
|
107 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 /* 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
|
119 NWidget(NWID_HORIZONTAL), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
120 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
121 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
122 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_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
|
123 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
|
124 /* 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
|
125 NWidget(NWID_HORIZONTAL), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
126 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
127 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
128 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_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
|
129 EndContainer(), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
130 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
131 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_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
|
132 EndContainer(), |
11561
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
133 EndContainer(), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
134 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0), |
17958
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
135 NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0), |
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
136 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), SetFill(1, 1), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
137 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
17958
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
138 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
|
139 NWidget(NWID_SPACER), SetFill(1, 1), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
140 NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_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
|
141 EndContainer(), |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
142 EndContainer(), |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
143 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
|
144 /* 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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 EndContainer(), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
150 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_NW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_NORTHWEST), SetFill(1, 1), |
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
151 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 EndContainer(), |
19766
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
162 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_WATER_SW), SetDataTip(STR_JUST_STRING, STR_MAPGEN_SOUTHWEST), SetFill(1, 1), |
bef904e13552
(svn r24699) -Codechange: Proper usage of push and toggle buttons in mapgen and script debug GUI.
frosch <frosch@openttd.org>
parents:
19765
diff
changeset
|
163 NWidget(WWT_TEXTBTN, COLOUR_ORANGE, WID_GL_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
|
164 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
|
165 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
|
166 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
|
167 EndContainer(), |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
168 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
|
169 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
|
170 EndContainer(), |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
171 }; |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
172 |
14309
9c8decad5dfe
(svn r18861) -Doc: more doxygen documentation in genworld files
smatz <smatz@openttd.org>
parents:
14307
diff
changeset
|
173 /** Widgets of GenerateLandscapeWindow when loading heightmap */ |
11561
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
174 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
|
175 /* Window header. */ |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 /* 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
|
183 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
|
184 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
185 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
186 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
187 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
188 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
189 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
190 NWidget(NWID_SPACER), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
191 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_GL_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
|
192 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
|
193 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
|
194 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
|
195 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
|
196 /* 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_RANDOM_SEED, STR_NULL), SetFill(1, 1), |
18080
8da85647cab8
(svn r22901) -Fix (r22767): The river density dropdown was missing in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18010
diff
changeset
|
203 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_QUANTITY_OF_RIVERS, STR_NULL), 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
|
204 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
|
205 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
|
206 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
|
207 /* Widgets at the right of the labels. */ |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
208 NWidget(NWID_VERTICAL), SetPIP(0, 4, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
209 NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_GL_HEIGHTMAP_NAME_TEXT), SetFill(1, 0), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
210 NWidget(NWID_HORIZONTAL), SetPIP(0, 5, 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
|
211 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
212 /* Mapsize X * Y. */ |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
213 NWidget(NWID_HORIZONTAL), SetPIP(0, 4, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
214 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
215 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 0, 0, 0), SetFill(1, 1), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
216 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
217 EndContainer(), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
218 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TOWN_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
219 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_INDUSTRY_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
19814
173b8706e0d6
(svn r24747) -Fix: Some editboxes had a different colour than the rest of the window.
frosch <frosch@openttd.org>
parents:
19809
diff
changeset
|
220 NWidget(WWT_EDITBOX, COLOUR_ORANGE, WID_GL_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
221 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_RIVER_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
222 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_TREE_PULLDOWN), SetDataTip(STR_JUST_STRING, STR_NULL), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
223 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_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
|
224 EndContainer(), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
225 NWidget(NWID_VERTICAL), SetPIP(0, 4, 0), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
226 NWidget(NWID_HORIZONTAL), SetPIP(0, 3, 0), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
227 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
228 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE_LABEL, STR_NULL), SetFill(1, 1), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
229 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_DATE, STR_NULL), SetFill(1, 1), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
230 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_SNOW_LINE_HEIGHT, STR_NULL), SetFill(1, 1), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
231 EndContainer(), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
232 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 4, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
233 NWidget(WWT_TEXT, COLOUR_ORANGE, WID_GL_HEIGHTMAP_SIZE_TEXT), SetDataTip(STR_MAPGEN_HEIGHTMAP_SIZE, STR_NULL), SetFill(1, 0), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
234 NWidget(NWID_HORIZONTAL), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
235 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), SetFill(0, 1), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
236 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
237 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_START_DATE_UP), SetDataTip(SPR_ARROW_UP, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_FORWARD), SetFill(0, 1), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
238 EndContainer(), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
239 NWidget(NWID_HORIZONTAL), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
240 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_DOWN), SetDataTip(SPR_ARROW_DOWN, STR_MAPGEN_SNOW_LINE_DOWN), SetFill(0, 1), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
241 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
242 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_GL_SNOW_LEVEL_UP), SetDataTip(SPR_ARROW_UP, STR_MAPGEN_SNOW_LINE_UP), SetFill(0, 1), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
243 EndContainer(), |
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
244 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
|
245 EndContainer(), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
246 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_GL_RANDOM_BUTTON), SetDataTip(STR_MAPGEN_RANDOM, STR_MAPGEN_RANDOM_HELP), SetFill(1, 0), |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
247 NWidget(NWID_SPACER), SetFill(1, 1), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
248 NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_GL_GENERATE_BUTTON), SetMinimalSize(84, 30), SetDataTip(STR_MAPGEN_GENERATE, 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 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
|
254 EndContainer(), |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
255 }; |
0fcdcc728f43
(svn r15927) -Codechange: Added nested widget for generate-world windows
alberth <alberth@openttd.org>
parents:
11543
diff
changeset
|
256 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
257 static void StartGeneratingLandscape(GenenerateLandscapeWindowMode mode) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
258 { |
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
|
259 DeleteAllNonVitalWindows(); |
18628
718c69c25a56
(svn r23475) -Codechange: queue critical error messages, so when multiple happen you won't miss any
rubidium <rubidium@openttd.org>
parents:
18623
diff
changeset
|
260 ClearErrorMessages(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
261 |
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
|
262 /* 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
|
263 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
|
264 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
|
265 |
19913
f4e2c852270b
(svn r24846) -Add: Advanced settings to disable certain sound effects.
frosch <frosch@openttd.org>
parents:
19868
diff
changeset
|
266 if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
267 switch (mode) { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
268 case GLWM_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break; |
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
269 case GLWM_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break; |
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
270 case GLWM_SCENARIO: _switch_mode = SM_EDITOR; break; |
5894
c4ab8176e02e
(svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater <Darkvater@openttd.org>
parents:
5893
diff
changeset
|
271 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
|
272 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
273 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
274 |
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
|
275 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
|
276 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
277 if (confirmed) StartGeneratingLandscape((GenenerateLandscapeWindowMode)w->window_number); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
278 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
279 |
8327
b5058eea06a1
(svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
280 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
|
281 { |
b5058eea06a1
(svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
282 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
|
283 |
12227
307cf47f1c3a
(svn r16642) -Codechange: use map size limits enum at one more place
smatz <smatz@openttd.org>
parents:
12037
diff
changeset
|
284 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
|
285 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
|
286 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
|
287 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
|
288 } |
b5058eea06a1
(svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
289 |
b5058eea06a1
(svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
290 return list; |
b5058eea06a1
(svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
291 } |
b5058eea06a1
(svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents:
8284
diff
changeset
|
292 |
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
|
293 static const StringID _elevations[] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, INVALID_STRING_ID}; |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
294 static const StringID _sea_lakes[] = {STR_SEA_LEVEL_VERY_LOW, STR_SEA_LEVEL_LOW, STR_SEA_LEVEL_MEDIUM, STR_SEA_LEVEL_HIGH, STR_SEA_LEVEL_CUSTOM, INVALID_STRING_ID}; |
17958
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
295 static const StringID _rivers[] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT, 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
|
296 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
|
297 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
|
298 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
|
299 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
|
300 static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM, INVALID_STRING_ID}; |
17232
5d82f4101601
(svn r21972) -Fix: Replace 'None' industries in the generation window with more descriptive label.
alberth <alberth@openttd.org>
parents:
17229
diff
changeset
|
301 static const StringID _num_inds[] = {STR_FUNDING_ONLY, STR_MINIMAL, 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
|
302 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
|
303 |
17260
279b6d94357f
(svn r22000) -Codechange: Introduce an enum for the industry density setting.
alberth <alberth@openttd.org>
parents:
17232
diff
changeset
|
304 assert_compile(lengthof(_num_inds) == ID_END + 1); |
279b6d94357f
(svn r22000) -Codechange: Introduce an enum for the industry density setting.
alberth <alberth@openttd.org>
parents:
17232
diff
changeset
|
305 |
19809
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
306 struct GenerateLandscapeWindow : public Window { |
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
|
307 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
|
308 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
|
309 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
|
310 char name[64]; |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
311 GenenerateLandscapeWindowMode mode; |
19809
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
312 QueryString seed_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
|
313 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
314 GenerateLandscapeWindow(WindowDesc *desc, WindowNumber number = 0) : Window(desc), seed_editbox(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
|
315 { |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
316 this->InitNested(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
|
317 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
318 this->LowerWidget(_settings_newgame.game_creation.landscape + WID_GL_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
|
319 |
19809
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
320 this->querystrings[WID_GL_RANDOM_EDITBOX] = &this->seed_editbox; |
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
321 this->seed_editbox.text.Print("%u", _settings_newgame.game_creation.generation_seed); |
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
322 this->seed_editbox.caption = STR_NULL; |
20145
182822e16d5d
(svn r25089) -Codechange: Move CharSetFilter from QueryString to Textbuf.
frosch <frosch@openttd.org>
parents:
19993
diff
changeset
|
323 this->seed_editbox.text.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
|
324 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
325 this->mode = (GenenerateLandscapeWindowMode)this->window_number; |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
326 |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
327 /* Disable town, industry and trees in SE */ |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
328 this->SetWidgetDisabledState(WID_GL_TOWN_PULLDOWN, _game_mode == GM_EDITOR); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
329 this->SetWidgetDisabledState(WID_GL_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
330 this->SetWidgetDisabledState(WID_GL_TREE_PULLDOWN, _game_mode == GM_EDITOR); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
331 |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
332 this->OnInvalidateData(); |
13493
dec4ce746e13
(svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents:
13490
diff
changeset
|
333 } |
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
|
334 |
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
|
335 |
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
|
336 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
|
337 { |
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
|
338 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
339 case WID_GL_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
340 case WID_GL_MAPSIZE_X_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_x); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
341 case WID_GL_MAPSIZE_Y_PULLDOWN: SetDParam(0, 1 << _settings_newgame.game_creation.map_y); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
342 case WID_GL_SNOW_LEVEL_TEXT: SetDParam(0, _settings_newgame.game_creation.snow_line_height); break; |
16135
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
343 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
344 case WID_GL_TOWN_PULLDOWN: |
16135
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
345 if (_game_mode == GM_EDITOR) { |
17457
1a8bb6dc6dc6
(svn r22211) -Codechange: Unduplicate Off/On strings.
alberth <alberth@openttd.org>
parents:
17261
diff
changeset
|
346 SetDParam(0, STR_CONFIG_SETTING_OFF); |
16135
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
347 } else if (_settings_newgame.difficulty.number_towns == CUSTOM_TOWN_NUMBER_DIFFICULTY) { |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
348 SetDParam(0, STR_NUM_CUSTOM_NUMBER); |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
349 SetDParam(1, _settings_newgame.game_creation.custom_town_number); |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
350 } else { |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
351 SetDParam(0, _num_towns[_settings_newgame.difficulty.number_towns]); |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
352 } |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
353 break; |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
354 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
355 case WID_GL_INDUSTRY_PULLDOWN: SetDParam(0, _game_mode == GM_EDITOR ? STR_CONFIG_SETTING_OFF : _num_inds[_settings_newgame.difficulty.industry_density]); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
356 case WID_GL_LANDSCAPE_PULLDOWN: SetDParam(0, _landscape[_settings_newgame.game_creation.land_generator]); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
357 case WID_GL_TREE_PULLDOWN: SetDParam(0, _tree_placer[_settings_newgame.game_creation.tree_placer]); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
358 case WID_GL_TERRAIN_PULLDOWN: SetDParam(0, _elevations[_settings_newgame.difficulty.terrain_type]); break; |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
359 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
360 case WID_GL_WATER_PULLDOWN: |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
361 if (_settings_newgame.difficulty.quantity_sea_lakes == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
362 SetDParam(0, STR_SEA_LEVEL_CUSTOM_PERCENTAGE); |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
363 SetDParam(1, _settings_newgame.game_creation.custom_sea_level); |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
364 } else { |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
365 SetDParam(0, _sea_lakes[_settings_newgame.difficulty.quantity_sea_lakes]); |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
366 } |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
367 break; |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
368 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
369 case WID_GL_RIVER_PULLDOWN: SetDParam(0, _rivers[_settings_newgame.game_creation.amount_of_rivers]); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
370 case WID_GL_SMOOTHNESS_PULLDOWN: SetDParam(0, _smoothness[_settings_newgame.game_creation.tgen_smoothness]); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
371 case WID_GL_VARIETY_PULLDOWN: SetDParam(0, _variety[_settings_newgame.game_creation.variety]); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
372 case WID_GL_BORDERS_RANDOM: SetDParam(0, (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? STR_MAPGEN_BORDER_RANDOMIZE : STR_MAPGEN_BORDER_MANUAL); break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
373 case WID_GL_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; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
374 case WID_GL_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; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
375 case WID_GL_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; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
376 case WID_GL_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; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
377 case WID_GL_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
|
378 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
379 case WID_GL_HEIGHTMAP_SIZE_TEXT: |
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
|
380 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
|
381 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
|
382 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
|
383 } 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
|
384 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
|
385 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
|
386 } |
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 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
|
388 } |
dec4ce746e13
(svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents:
13490
diff
changeset
|
389 } |
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
|
390 |
17486
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
391 /** |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
392 * Some data on this window has become invalid. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
393 * @param data Information about the changed data. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
394 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
395 */ |
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
396 virtual void OnInvalidateData(int data = 0, bool gui_scope = true) |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
397 { |
17486
e7672bafbe1c
(svn r22241) -Codechange: Add additional to-be-used parameter to OnInvalidateData().
frosch <frosch@openttd.org>
parents:
17457
diff
changeset
|
398 if (!gui_scope) return; |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
399 /* Update the climate buttons */ |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
400 this->SetWidgetLoweredState(WID_GL_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
401 this->SetWidgetLoweredState(WID_GL_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
402 this->SetWidgetLoweredState(WID_GL_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
403 this->SetWidgetLoweredState(WID_GL_TOYLAND, _settings_newgame.game_creation.landscape == LT_TOYLAND); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
404 |
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
405 /* You can't select smoothness / non-water borders if not terragenesis */ |
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
406 if (mode == GLWM_GENERATE) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
407 this->SetWidgetDisabledState(WID_GL_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
408 this->SetWidgetDisabledState(WID_GL_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == 0); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
409 this->SetWidgetDisabledState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
410 this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM, |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
411 WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW, WIDGET_LIST_END); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
412 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
413 this->SetWidgetLoweredState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
414 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
415 this->SetWidgetLoweredState(WID_GL_WATER_NW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NW)); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
416 this->SetWidgetLoweredState(WID_GL_WATER_NE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_NE)); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
417 this->SetWidgetLoweredState(WID_GL_WATER_SE, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SE)); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
418 this->SetWidgetLoweredState(WID_GL_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW)); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
419 |
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
420 this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == 0 && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
421 WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN, WIDGET_LIST_END); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
422 } |
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
423 |
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
424 /* Disable snowline if not arctic */ |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
425 this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_TEXT, _settings_newgame.game_creation.landscape != LT_ARCTIC); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
426 |
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
427 /* Update availability of decreasing / increasing start date and snow level */ |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
428 this->SetWidgetDisabledState(WID_GL_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
429 this->SetWidgetDisabledState(WID_GL_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
430 this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= MIN_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
431 this->SetWidgetDisabledState(WID_GL_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _settings_newgame.game_creation.landscape != LT_ARCTIC); |
16364
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
432 |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
433 /* Do not allow a custom sea level with the original land generator. */ |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
434 if (_settings_newgame.game_creation.land_generator == 0 && |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
435 _settings_newgame.difficulty.quantity_sea_lakes == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
436 _settings_newgame.difficulty.quantity_sea_lakes = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE; |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
437 } |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
438 |
15237
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
439 } |
ee05ac91d67f
(svn r19871) -Fix [FS#3826]: update the landscape buttons in the main menu / newgame window correctly (planetmaker)
yexo <yexo@openttd.org>
parents:
14409
diff
changeset
|
440 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
441 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
|
442 { |
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
|
443 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
|
444 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
445 case WID_GL_START_DATE_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
|
446 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
|
447 *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
|
448 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
|
449 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
450 case WID_GL_MAPSIZE_X_PULLDOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
451 case WID_GL_MAPSIZE_Y_PULLDOWN: |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
452 SetDParamMaxValue(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
|
453 *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
|
454 break; |
dec4ce746e13
(svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents:
13490
diff
changeset
|
455 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
456 case WID_GL_SNOW_LEVEL_TEXT: |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
457 SetDParamMaxValue(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
|
458 *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
|
459 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
|
460 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
461 case WID_GL_HEIGHTMAP_SIZE_TEXT: |
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
|
462 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
|
463 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
|
464 *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
|
465 break; |
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
466 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
467 case WID_GL_TOWN_PULLDOWN: |
16135
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
468 strs = _num_towns; |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
469 SetDParamMaxValue(0, CUSTOM_TOWN_MAX_NUMBER); |
16135
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
470 *size = GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER); |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
471 break; |
1ac9cc3debac
(svn r20831) -Add: Show selected number of towns in the map generation window when using a custom amount.
terkhen <terkhen@openttd.org>
parents:
15944
diff
changeset
|
472 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
473 case WID_GL_INDUSTRY_PULLDOWN: strs = _num_inds; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
474 case WID_GL_LANDSCAPE_PULLDOWN: strs = _landscape; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
475 case WID_GL_TREE_PULLDOWN: strs = _tree_placer; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
476 case WID_GL_TERRAIN_PULLDOWN: strs = _elevations; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
477 case WID_GL_WATER_PULLDOWN: |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
478 strs = _sea_lakes; |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
479 SetDParamMaxValue(0, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE); |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
480 *size = GetStringBoundingBox(STR_SEA_LEVEL_CUSTOM_PERCENTAGE); |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
481 break; |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
482 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
483 case WID_GL_RIVER_PULLDOWN: strs = _rivers; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
484 case WID_GL_SMOOTHNESS_PULLDOWN: strs = _smoothness; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
485 case WID_GL_VARIETY_PULLDOWN: strs = _variety; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
486 case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: strs = _rotation; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
487 case WID_GL_BORDERS_RANDOM: |
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
|
488 *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
|
489 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
|
490 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
491 case WID_GL_WATER_NE: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
492 case WID_GL_WATER_NW: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
493 case WID_GL_WATER_SE: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
494 case WID_GL_WATER_SW: |
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
|
495 *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
|
496 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
|
497 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
498 case WID_GL_HEIGHTMAP_NAME_TEXT: |
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
|
499 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
|
500 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
|
501 |
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
|
502 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
|
503 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
|
504 } |
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
|
505 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
|
506 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
|
507 *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
|
508 } |
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
509 } |
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
|
510 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
|
511 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
|
512 } |
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
513 |
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
514 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
|
515 { |
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
516 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
517 case WID_GL_HEIGHTMAP_NAME_TEXT: { |
18081
de1b4dfd8ba7
(svn r22902) -Fix: The name of the heightmap glitches in the 'play heightmap' window.
frosch <frosch@openttd.org>
parents:
18080
diff
changeset
|
518 DrawString(r.left, r.right, r.top, this->name, TC_ORANGE); |
15618
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15537
diff
changeset
|
519 break; |
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15537
diff
changeset
|
520 } |
13496
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
521 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
522 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
523 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14346
diff
changeset
|
524 virtual void OnClick(Point pt, int widget, int click_count) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
525 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
526 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
527 case WID_GL_TEMPERATE: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
528 case WID_GL_ARCTIC: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
529 case WID_GL_TROPICAL: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
530 case WID_GL_TOYLAND: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
531 SetNewLandscapeType(widget - WID_GL_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
|
532 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
533 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
534 case WID_GL_MAPSIZE_X_PULLDOWN: // Mapsize X |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
535 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, WID_GL_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
|
536 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
|
537 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
538 case WID_GL_MAPSIZE_Y_PULLDOWN: // Mapsize Y |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
539 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, WID_GL_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
|
540 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
|
541 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
542 case WID_GL_TOWN_PULLDOWN: // Number of towns |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
543 ShowDropDownMenu(this, _num_towns, _settings_newgame.difficulty.number_towns, WID_GL_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
|
544 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
|
545 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
546 case WID_GL_INDUSTRY_PULLDOWN: // Number of industries |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
547 ShowDropDownMenu(this, _num_inds, _settings_newgame.difficulty.industry_density, WID_GL_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
|
548 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
549 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
550 case WID_GL_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
|
551 _settings_newgame.game_creation.generation_seed = InteractiveRandom(); |
19809
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
552 this->seed_editbox.text.Print("%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
|
553 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
|
554 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
|
555 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
556 case WID_GL_GENERATE_BUTTON: { // Generate |
17817
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
557 /* Get rotated map size. */ |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
558 uint map_x; |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
559 uint map_y; |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
560 if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) { |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
561 map_x = this->y; |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
562 map_y = this->x; |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
563 } else { |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
564 map_x = this->x; |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
565 map_y = this->y; |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
566 } |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
567 if (mode == GLWM_HEIGHTMAP && |
17817
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
568 (map_x * 2 < (1U << _settings_newgame.game_creation.map_x) || |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
569 map_x / 2 > (1U << _settings_newgame.game_creation.map_x) || |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
570 map_y * 2 < (1U << _settings_newgame.game_creation.map_y) || |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
571 map_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
|
572 ShowQuery( |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
573 STR_WARNING_HEIGHTMAP_SCALE_CAPTION, |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
574 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
|
575 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
|
576 LandscapeGenerationCallback); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
577 } 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
|
578 StartGeneratingLandscape(mode); |
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 break; |
17817
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
581 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
582 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
583 case WID_GL_START_DATE_DOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
584 case WID_GL_START_DATE_UP: // Year buttons |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
585 /* Don't allow too fast scrolling */ |
18731
df35e3840acf
(svn r23579) -Fix (r23525): Most up/down arrows stopped working.
frosch <frosch@openttd.org>
parents:
18683
diff
changeset
|
586 if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) { |
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
|
587 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
|
588 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
589 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_GL_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
590 this->InvalidateData(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
591 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 _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
|
593 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
594 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
595 case WID_GL_START_DATE_TEXT: // Year text |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
596 this->widget_id = WID_GL_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
|
597 SetDParam(0, _settings_newgame.game_creation.starting_year); |
17579
105b4e4eb168
(svn r22343) -Change: Remove pixel limiter for query strings.
terkhen <terkhen@openttd.org>
parents:
17501
diff
changeset
|
598 ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
599 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
|
600 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
601 case WID_GL_SNOW_LEVEL_DOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
602 case WID_GL_SNOW_LEVEL_UP: // Snow line buttons |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
603 /* Don't allow too fast scrolling */ |
18731
df35e3840acf
(svn r23579) -Fix (r23525): Most up/down arrows stopped working.
frosch <frosch@openttd.org>
parents:
18683
diff
changeset
|
604 if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) { |
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
|
605 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
|
606 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
607 _settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - WID_GL_SNOW_LEVEL_TEXT, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
608 this->InvalidateData(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
609 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
610 _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
|
611 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
|
612 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
613 case WID_GL_SNOW_LEVEL_TEXT: // Snow line text |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
614 this->widget_id = WID_GL_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
|
615 SetDParam(0, _settings_newgame.game_creation.snow_line_height); |
17579
105b4e4eb168
(svn r22343) -Change: Remove pixel limiter for query strings.
terkhen <terkhen@openttd.org>
parents:
17501
diff
changeset
|
616 ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 3, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
617 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
|
618 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
619 case WID_GL_TREE_PULLDOWN: // Tree placer |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
620 ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, WID_GL_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
|
621 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
|
622 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
623 case WID_GL_LANDSCAPE_PULLDOWN: // Landscape generator |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
624 ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, WID_GL_LANDSCAPE_PULLDOWN, 0, 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
|
625 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
|
626 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
627 case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: // Heightmap rotation |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
628 ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, WID_GL_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
|
629 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
|
630 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
631 case WID_GL_TERRAIN_PULLDOWN: // Terrain type |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
632 ShowDropDownMenu(this, _elevations, _settings_newgame.difficulty.terrain_type, WID_GL_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
|
633 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
634 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
635 case WID_GL_WATER_PULLDOWN: { // Water quantity |
16364
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
636 uint32 hidden_mask = 0; |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
637 /* Disable custom water level when the original map generator is active. */ |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
638 if (_settings_newgame.game_creation.land_generator == 0) { |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
639 SetBit(hidden_mask, CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY); |
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
640 } |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
641 ShowDropDownMenu(this, _sea_lakes, _settings_newgame.difficulty.quantity_sea_lakes, WID_GL_WATER_PULLDOWN, 0, hidden_mask); |
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
|
642 break; |
16364
a58556d22708
(svn r21080) -Fix: Do not allow to use a custom water level with the original map generator.
terkhen <terkhen@openttd.org>
parents:
16326
diff
changeset
|
643 } |
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
|
644 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
645 case WID_GL_RIVER_PULLDOWN: // Amount of rivers |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
646 ShowDropDownMenu(this, _rivers, _settings_newgame.game_creation.amount_of_rivers, WID_GL_RIVER_PULLDOWN, 0, 0); |
17958
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
647 break; |
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
648 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
649 case WID_GL_SMOOTHNESS_PULLDOWN: // Map smoothness |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
650 ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, WID_GL_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
|
651 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
|
652 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
653 case WID_GL_VARIETY_PULLDOWN: // Map variety |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
654 ShowDropDownMenu(this, _variety, _settings_newgame.game_creation.variety, WID_GL_VARIETY_PULLDOWN, 0, 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
|
655 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
|
656 |
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
|
657 /* Freetype map borders */ |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
658 case WID_GL_WATER_NW: |
10877
e9c95718d466
(svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents:
10855
diff
changeset
|
659 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NW); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
660 this->InvalidateData(); |
10877
e9c95718d466
(svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents:
10855
diff
changeset
|
661 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
|
662 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
663 case WID_GL_WATER_NE: |
10877
e9c95718d466
(svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents:
10855
diff
changeset
|
664 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_NE); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
665 this->InvalidateData(); |
10877
e9c95718d466
(svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents:
10855
diff
changeset
|
666 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
|
667 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
668 case WID_GL_WATER_SE: |
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
|
669 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SE); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
670 this->InvalidateData(); |
10877
e9c95718d466
(svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents:
10855
diff
changeset
|
671 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
|
672 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
673 case WID_GL_WATER_SW: |
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
|
674 _settings_newgame.game_creation.water_borders = ToggleBit(_settings_newgame.game_creation.water_borders, BORDER_SW); |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
675 this->InvalidateData(); |
10877
e9c95718d466
(svn r15212) -Feature [FS#2566]: Change the dropdown box where you can chose which edges will be water to 4 pushbuttons (based on patch by planetmaker).
Yexo <Yexo@openttd.org>
parents:
10855
diff
changeset
|
676 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
|
677 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
678 case WID_GL_BORDERS_RANDOM: |
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
|
679 _settings_newgame.game_creation.water_borders = (_settings_newgame.game_creation.water_borders == BORDERS_RANDOM) ? 0 : BORDERS_RANDOM; |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
680 this->InvalidateData(); |
10855
7881d9cd55ab
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents:
10784
diff
changeset
|
681 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
|
682 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
683 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
684 |
12739
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
685 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
|
686 { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
687 static const int raise_widgets[] = {WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WIDGET_LIST_END}; |
12739
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
688 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
|
689 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
|
690 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
|
691 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
|
692 } |
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
693 } |
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
694 } |
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
695 |
19801
b9d951089320
(svn r24734) -Codechange: Move QueryStringBaseWindow::OnOSKInput to Window::OnEditboxChanged.
frosch <frosch@openttd.org>
parents:
19800
diff
changeset
|
696 virtual void OnEditboxChanged(int wid) |
19794
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
697 { |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
698 if (wid == WID_GL_RANDOM_EDITBOX) { |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
699 /* the seed is unsigned, therefore atoi cannot be used. |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
700 * As UINT32_MAX is a 'magic' value (use random seed) it |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
701 * should not be possible to be entered into the input |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
702 * field; the generate seed button can be used instead. */ |
19809
4df2993a99a6
(svn r24742) -Codechange: Remove QueryStringBaseWindow and store QueryStrings per widget instead.
frosch <frosch@openttd.org>
parents:
19807
diff
changeset
|
703 _settings_newgame.game_creation.generation_seed = minu(strtoul(this->seed_editbox.text.buf, NULL, 10), UINT32_MAX - 1); |
19794
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
704 } |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
705 } |
d06d57367979
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
frosch <frosch@openttd.org>
parents:
19793
diff
changeset
|
706 |
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
|
707 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
|
708 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
709 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
710 case WID_GL_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
711 case WID_GL_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
712 case WID_GL_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
713 case WID_GL_RIVER_PULLDOWN: _settings_newgame.game_creation.amount_of_rivers = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
714 case WID_GL_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
715 case WID_GL_VARIETY_PULLDOWN: _settings_newgame.game_creation.variety = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
716 case WID_GL_LANDSCAPE_PULLDOWN: _settings_newgame.game_creation.land_generator = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
717 case WID_GL_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
|
718 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
719 case WID_GL_TOWN_PULLDOWN: |
11347
8656dc2695e9
(svn r15697) -Fix (r15695): warning about comparing signed vs unsigned.
rubidium <rubidium@openttd.org>
parents:
11345
diff
changeset
|
720 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
|
721 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
|
722 SetDParam(0, _settings_newgame.game_creation.custom_town_number); |
17579
105b4e4eb168
(svn r22343) -Change: Remove pixel limiter for query strings.
terkhen <terkhen@openttd.org>
parents:
17501
diff
changeset
|
723 ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_TOWNS, 5, this, CS_NUMERAL, QSF_NONE); |
17066
21cc53f6368d
(svn r21803) -Cleanup: Remove unnecessary semicolons.
terkhen <terkhen@openttd.org>
parents:
16601
diff
changeset
|
724 } |
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
|
725 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
|
726 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
|
727 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
728 case WID_GL_INDUSTRY_PULLDOWN: |
17261
2d2cbb8602d2
(svn r22001) -Codechange: Rename difficulty.number_industries to difficulty.industry_density.
alberth <alberth@openttd.org>
parents:
17260
diff
changeset
|
729 IConsoleSetSetting("difficulty.industry_density", 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
|
730 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
731 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
732 case WID_GL_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
|
733 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
|
734 _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
|
735 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
|
736 _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
|
737 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
|
738 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
739 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
740 case WID_GL_WATER_PULLDOWN: { |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
741 if ((uint)index == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
742 this->widget_id = widget; |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
743 SetDParam(0, _settings_newgame.game_creation.custom_sea_level); |
17579
105b4e4eb168
(svn r22343) -Change: Remove pixel limiter for query strings.
terkhen <terkhen@openttd.org>
parents:
17501
diff
changeset
|
744 ShowQueryString(STR_JUST_INT, STR_MAPGEN_QUANTITY_OF_SEA_LAKES, 3, this, CS_NUMERAL, QSF_NONE); |
17066
21cc53f6368d
(svn r21803) -Cleanup: Remove unnecessary semicolons.
terkhen <terkhen@openttd.org>
parents:
16601
diff
changeset
|
745 } |
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
|
746 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
|
747 _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
|
748 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
|
749 _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
|
750 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
|
751 } |
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
|
752 } |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
753 this->InvalidateData(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
754 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
755 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
|
757 { |
14341
a19feda8e58a
(svn r18896) -Fix [FS#3558]: pressing cancel for the query windows of the world generation window caused the default to be set instead of no changes to the value
rubidium <rubidium@openttd.org>
parents:
14309
diff
changeset
|
758 /* Was 'cancel' pressed? */ |
a19feda8e58a
(svn r18896) -Fix [FS#3558]: pressing cancel for the query windows of the world generation window caused the default to be set instead of no changes to the value
rubidium <rubidium@openttd.org>
parents:
14309
diff
changeset
|
759 if (str == NULL) return; |
a19feda8e58a
(svn r18896) -Fix [FS#3558]: pressing cancel for the query windows of the world generation window caused the default to be set instead of no changes to the value
rubidium <rubidium@openttd.org>
parents:
14309
diff
changeset
|
760 |
14043
ac099bcf95d9
(svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents:
14042
diff
changeset
|
761 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
|
762 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
|
763 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
|
764 } 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
|
765 /* 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
|
766 switch (this->widget_id) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
767 case WID_GL_START_DATE_TEXT: value = DEF_START_YEAR; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
768 case WID_GL_SNOW_LEVEL_TEXT: value = DEF_SNOWLINE_HEIGHT; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
769 case WID_GL_TOWN_PULLDOWN: value = 1; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
770 case WID_GL_WATER_PULLDOWN: value = CUSTOM_SEA_LEVEL_MIN_PERCENTAGE; break; |
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
|
771 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
|
772 } |
ac099bcf95d9
(svn r18586) -Fix [FS#3398]: pressing default for the starting year/snow line height edit boxes of the world generation windows didn't work.
rubidium <rubidium@openttd.org>
parents:
14042
diff
changeset
|
773 } |
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
|
774 |
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
|
775 switch (this->widget_id) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
776 case WID_GL_START_DATE_TEXT: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
777 this->SetWidgetDirty(WID_GL_START_DATE_TEXT); |
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
|
778 _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
|
779 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
|
780 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
781 case WID_GL_SNOW_LEVEL_TEXT: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
782 this->SetWidgetDirty(WID_GL_SNOW_LEVEL_TEXT); |
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
|
783 _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
|
784 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
785 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
786 case WID_GL_TOWN_PULLDOWN: |
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
|
787 _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
|
788 break; |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
789 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
790 case WID_GL_WATER_PULLDOWN: |
16136
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
791 _settings_newgame.game_creation.custom_sea_level = Clamp(value, CUSTOM_SEA_LEVEL_MIN_PERCENTAGE, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE); |
be5b3d5d2a03
(svn r20832) -Feature: Allow to select a custom percentage of water in the map generation window (based on patch by CommanderZ).
terkhen <terkhen@openttd.org>
parents:
16135
diff
changeset
|
792 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
|
793 } |
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
|
794 |
15238
1cfb0b93d2c6
(svn r19872) -Codechange [FS#3826]: move the widget updates in the newgame gui to OnInvalidateData from OnPaint
yexo <yexo@openttd.org>
parents:
15237
diff
changeset
|
795 this->InvalidateData(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
796 } |
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
|
797 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
798 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
799 static WindowDesc _generate_landscape_desc( |
20338
491ddf49f744
(svn r25290) -Add: Assign string names to notable windows.
frosch <frosch@openttd.org>
parents:
20335
diff
changeset
|
800 WDP_CENTER, NULL, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5892
diff
changeset
|
801 WC_GENERATE_LANDSCAPE, WC_NONE, |
19767
2a11204038e3
(svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default.
frosch <frosch@openttd.org>
parents:
19766
diff
changeset
|
802 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
803 _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
|
804 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
805 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
806 static WindowDesc _heightmap_load_desc( |
20338
491ddf49f744
(svn r25290) -Add: Assign string names to notable windows.
frosch <frosch@openttd.org>
parents:
20335
diff
changeset
|
807 WDP_CENTER, NULL, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5892
diff
changeset
|
808 WC_GENERATE_LANDSCAPE, WC_NONE, |
19767
2a11204038e3
(svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default.
frosch <frosch@openttd.org>
parents:
19766
diff
changeset
|
809 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
810 _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
|
811 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
812 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
813 static void _ShowGenerateLandscape(GenenerateLandscapeWindowMode mode) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
814 { |
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
|
815 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
|
816 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
|
817 |
5901
6715d3646509
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents:
5899
diff
changeset
|
818 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
|
819 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
820 /* 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
|
821 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
|
822 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
823 if (mode == GLWM_HEIGHTMAP) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
824 /* 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
|
825 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
|
826 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
827 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
828 GenerateLandscapeWindow *w = AllocateWindowDescFront<GenerateLandscapeWindow>((mode == GLWM_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc, mode); |
7103
960e94818e5f
(svn r10370) -Fix: Heightmap GUI abused custom name system and used unnecessary globals. All details are now kept within the window's custom data.
peter1138 <peter1138@openttd.org>
parents:
7018
diff
changeset
|
829 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
830 if (mode == GLWM_HEIGHTMAP) { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
831 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
|
832 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
|
833 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
|
834 } |
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
|
835 |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
12849
diff
changeset
|
836 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
|
837 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
838 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
839 /** Start with a normal game. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
840 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
|
841 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
842 _ShowGenerateLandscape(GLWM_GENERATE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
843 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
844 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
845 /** Start with loading a heightmap. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
846 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
|
847 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
848 _ShowGenerateLandscape(GLWM_HEIGHTMAP); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
849 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
850 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
851 /** Start with a scenario editor. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
852 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
|
853 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
854 StartGeneratingLandscape(GLWM_SCENARIO); |
5899
71bc001a6dde
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents:
5894
diff
changeset
|
855 } |
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
|
856 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
857 /** |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
858 * Start a normal game without the GUI. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
859 * @param seed The seed of the new game. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
860 */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
861 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
|
862 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
863 /* 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
|
864 _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
|
865 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
866 StartGeneratingLandscape(GLWM_GENERATE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
867 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
868 |
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
|
869 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
|
870 { |
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
|
871 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
|
872 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
873 CreateScenarioWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc) |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
874 { |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
875 this->InitNested(window_number); |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
876 this->LowerWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE); |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
877 } |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
878 |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
879 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
|
880 { |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
881 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
882 case WID_CS_START_DATE_TEXT: |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
883 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
|
884 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
885 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
886 case WID_CS_MAPSIZE_X_PULLDOWN: |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
887 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
|
888 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
889 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
890 case WID_CS_MAPSIZE_Y_PULLDOWN: |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
891 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
|
892 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
893 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
894 case WID_CS_FLAT_LAND_HEIGHT_TEXT: |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
895 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
|
896 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
897 } |
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
|
898 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
899 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
900 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
|
901 { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
902 this->SetWidgetDisabledState(WID_CS_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
903 this->SetWidgetDisabledState(WID_CS_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
904 this->SetWidgetDisabledState(WID_CS_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
905 this->SetWidgetDisabledState(WID_CS_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
|
906 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
907 this->SetWidgetLoweredState(WID_CS_TEMPERATE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
908 this->SetWidgetLoweredState(WID_CS_ARCTIC, _settings_newgame.game_creation.landscape == LT_ARCTIC); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
909 this->SetWidgetLoweredState(WID_CS_TROPICAL, _settings_newgame.game_creation.landscape == LT_TROPIC); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
910 this->SetWidgetLoweredState(WID_CS_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
|
911 |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
912 this->DrawWidgets(); |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
913 } |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
914 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
915 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
|
916 { |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
917 StringID str = STR_JUST_INT; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
918 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
919 case WID_CS_START_DATE_TEXT: |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
920 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
|
921 str = STR_BLACK_DATE_LONG; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
922 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
|
923 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
924 case WID_CS_MAPSIZE_X_PULLDOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
925 case WID_CS_MAPSIZE_Y_PULLDOWN: |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
926 SetDParamMaxValue(0, MAX_MAP_SIZE); |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
927 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
928 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
929 case WID_CS_FLAT_LAND_HEIGHT_TEXT: |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
930 SetDParamMaxValue(0, MAX_TILE_HEIGHT); |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
931 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
932 |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
933 default: |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
934 return; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
935 } |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
936 *size = GetStringBoundingBox(str); |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
937 size->width += padding.width; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
938 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
|
939 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14346
diff
changeset
|
941 virtual void OnClick(Point pt, int widget, int click_count) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
942 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
944 case WID_CS_TEMPERATE: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
945 case WID_CS_ARCTIC: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
946 case WID_CS_TROPICAL: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
947 case WID_CS_TOYLAND: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
948 this->RaiseWidget(_settings_newgame.game_creation.landscape + WID_CS_TEMPERATE); |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
949 SetNewLandscapeType(widget - WID_CS_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
|
950 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
|
951 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
952 case WID_CS_MAPSIZE_X_PULLDOWN: // Mapsize X |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
953 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, WID_CS_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
|
954 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
|
955 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
956 case WID_CS_MAPSIZE_Y_PULLDOWN: // Mapsize Y |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
957 ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, WID_CS_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
|
958 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
959 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
960 case WID_CS_EMPTY_WORLD: // Empty world / flat world |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
961 StartGeneratingLandscape(GLWM_SCENARIO); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
962 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
|
963 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
964 case WID_CS_RANDOM_WORLD: // Generate |
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 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
|
966 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
967 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
968 case WID_CS_START_DATE_DOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
969 case WID_CS_START_DATE_UP: // Year buttons |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
970 /* Don't allow too fast scrolling */ |
18731
df35e3840acf
(svn r23579) -Fix (r23525): Most up/down arrows stopped working.
frosch <frosch@openttd.org>
parents:
18683
diff
changeset
|
971 if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) { |
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
|
972 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
|
973 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
|
974 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
975 _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - WID_CS_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
|
976 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 _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
|
978 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
979 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
980 case WID_CS_START_DATE_TEXT: // Year text |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
981 this->widget_id = WID_CS_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
|
982 SetDParam(0, _settings_newgame.game_creation.starting_year); |
17579
105b4e4eb168
(svn r22343) -Change: Remove pixel limiter for query strings.
terkhen <terkhen@openttd.org>
parents:
17501
diff
changeset
|
983 ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, 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
|
984 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
|
985 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
986 case WID_CS_FLAT_LAND_HEIGHT_DOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
987 case WID_CS_FLAT_LAND_HEIGHT_UP: // Height level buttons |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
988 /* Don't allow too fast scrolling */ |
18731
df35e3840acf
(svn r23579) -Fix (r23525): Most up/down arrows stopped working.
frosch <frosch@openttd.org>
parents:
18683
diff
changeset
|
989 if (!(this->flags & WF_TIMEOUT) || this->timeout_timer <= 1) { |
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
|
990 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
|
991 this->SetDirty(); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
992 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
993 _settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - WID_CS_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
|
994 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
995 _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
|
996 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
997 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
998 case WID_CS_FLAT_LAND_HEIGHT_TEXT: // Height level text |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
999 this->widget_id = WID_CS_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
|
1000 SetDParam(0, _settings_newgame.game_creation.se_flat_world_height); |
17579
105b4e4eb168
(svn r22343) -Change: Remove pixel limiter for query strings.
terkhen <terkhen@openttd.org>
parents:
17501
diff
changeset
|
1001 ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 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
|
1002 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
|
1003 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1005 |
13585
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1006 virtual void OnTimeout() |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1007 { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1008 static const int raise_widgets[] = {WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END}; |
13585
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1009 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
|
1010 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
|
1011 this->RaiseWidget(*widget); |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1012 this->SetWidgetDirty(*widget); |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1013 } |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1014 } |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1015 } |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1016 |
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
|
1017 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
|
1018 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1020 case WID_CS_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break; |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1021 case WID_CS_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
|
1022 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1023 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
|
1024 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1025 |
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
|
1026 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
|
1027 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1028 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
|
1029 int32 value = atoi(str); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1030 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1031 switch (this->widget_id) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1032 case WID_CS_START_DATE_TEXT: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1033 this->SetWidgetDirty(WID_CS_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
|
1034 _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
|
1035 break; |
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1036 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1037 case WID_CS_FLAT_LAND_HEIGHT_TEXT: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1038 this->SetWidgetDirty(WID_CS_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
|
1039 _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
|
1040 break; |
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1041 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1042 |
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
|
1043 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
|
1044 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1045 } |
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
|
1046 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1047 |
11537
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1048 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
|
1049 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
|
1050 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
|
1051 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
|
1052 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
|
1053 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
|
1054 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
|
1055 /* Landscape style selection. */ |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
1056 NWidget(NWID_HORIZONTAL), SetPIP(10, 3, 10), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1057 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TEMPERATE), SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1058 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_ARCTIC), SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1059 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_TROPICAL), SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1060 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_CS_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
|
1061 EndContainer(), |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
1062 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
|
1063 /* 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
|
1064 NWidget(NWID_VERTICAL), SetPIP(10, 6, 10), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
1065 NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_CS_EMPTY_WORLD), SetDataTip(STR_SE_MAPGEN_FLAT_WORLD, STR_SE_MAPGEN_FLAT_WORLD_TOOLTIP), SetFill(1, 1), |
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
1066 NWidget(WWT_PUSHTXTBTN, COLOUR_GREEN, WID_CS_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
|
1067 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1068 /* Labels + setting drop-downs */ |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
1069 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
|
1070 /* Map size. */ |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1071 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
|
1072 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
|
1073 NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1074 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_CS_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
|
1075 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_BY, STR_NULL), SetPadding(1, 2, 0, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1076 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_CS_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
|
1077 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1078 /* Date. */ |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1079 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
|
1080 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
|
1081 NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1082 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_START_DATE_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SCENEDIT_TOOLBAR_TOOLTIP_MOVE_THE_STARTING_DATE_BACKWARD), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
1083 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CS_START_DATE_TEXT), SetDataTip(STR_BLACK_DATE_LONG, STR_NULL), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1084 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_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
|
1085 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1086 /* Flat map height. */ |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1087 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
|
1088 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
|
1089 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
|
1090 NWidget(NWID_SPACER), SetMinimalSize(6, 0), SetFill(1, 0), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1091 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_DOWN), SetFill(0, 1), SetDataTip(SPR_ARROW_DOWN, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_DOWN), |
19765
3c569656848f
(svn r24698) -Codechange: Use PUSH-buttons when buttons can be pushed.
frosch <frosch@openttd.org>
parents:
19421
diff
changeset
|
1092 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_CS_FLAT_LAND_HEIGHT_TEXT), SetDataTip(STR_BLACK_INT, STR_NULL), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1093 NWidget(WWT_IMGBTN, COLOUR_ORANGE, WID_CS_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
|
1094 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1095 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1096 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1097 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1098 }; |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1099 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
1100 static WindowDesc _create_scenario_desc( |
20338
491ddf49f744
(svn r25290) -Add: Assign string names to notable windows.
frosch <frosch@openttd.org>
parents:
20335
diff
changeset
|
1101 WDP_CENTER, NULL, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5892
diff
changeset
|
1102 WC_GENERATE_LANDSCAPE, WC_NONE, |
19767
2a11204038e3
(svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default.
frosch <frosch@openttd.org>
parents:
19766
diff
changeset
|
1103 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
1104 _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
|
1105 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1106 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
1107 /** Show the window to create a scenario. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
1108 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
|
1109 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1110 DeleteWindowByClass(WC_GENERATE_LANDSCAPE); |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
1111 new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1112 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1113 |
11521
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1114 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
|
1115 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
|
1116 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
|
1117 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
|
1118 NWidget(NWID_VERTICAL), SetPIP(11, 8, 11), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1119 NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_BAR), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1120 NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_TEXT), SetFill(1, 0), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1121 NWidget(WWT_TEXTBTN, COLOUR_WHITE, WID_GP_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
|
1122 EndContainer(), |
11521
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1123 EndContainer(), |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1124 EndContainer(), |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1125 }; |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1126 |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1127 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
1128 static WindowDesc _generate_progress_desc( |
20338
491ddf49f744
(svn r25290) -Add: Assign string names to notable windows.
frosch <frosch@openttd.org>
parents:
20335
diff
changeset
|
1129 WDP_CENTER, NULL, 0, 0, |
17980
6c4dd98f3490
(svn r22789) -Codechange: rename generation window class to modal progress
rubidium <rubidium@openttd.org>
parents:
17979
diff
changeset
|
1130 WC_MODAL_PROGRESS, WC_NONE, |
19767
2a11204038e3
(svn r24700) -Cleanup: Remove WDF_UNCLICK_BUTTONS and make it the default.
frosch <frosch@openttd.org>
parents:
19766
diff
changeset
|
1131 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
1132 _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
|
1133 ); |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1134 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1135 struct GenWorldStatus { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1136 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
|
1137 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
|
1138 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
|
1139 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
|
1140 int timer; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
1141 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1142 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1143 static GenWorldStatus _gws; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1144 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1145 static const StringID _generation_class_table[] = { |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1146 STR_GENERATION_WORLD_GENERATION, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1147 STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION, |
17959
f3113a29d867
(svn r22768) -Add: progress bar updates for river building
rubidium <rubidium@openttd.org>
parents:
17958
diff
changeset
|
1148 STR_GENERATION_RIVER_GENERATION, |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1149 STR_GENERATION_CLEARING_TILES, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1150 STR_SCENEDIT_TOOLBAR_TOWN_GENERATION, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1151 STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION, |
15744
f9e8032ac213
(svn r20411) -Codechange: rename unmovables as quite a lot of them are actually movable; e.g. HQ and owned land are pretty movable.
rubidium <rubidium@openttd.org>
parents:
15618
diff
changeset
|
1152 STR_GENERATION_OBJECT_GENERATION, |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1153 STR_GENERATION_TREE_GENERATION, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1154 STR_GENERATION_SETTINGUP_GAME, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1155 STR_GENERATION_PREPARING_TILELOOP, |
18763
10757b027360
(svn r23611) -Add: run the begin of the script already while generating, and don't sleep on DoCommand while doing so
truebrain <truebrain@openttd.org>
parents:
18731
diff
changeset
|
1156 STR_GENERATION_PREPARING_SCRIPT, |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1157 STR_GENERATION_PREPARING_GAME |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1158 }; |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1159 assert_compile(lengthof(_generation_class_table) == GWP_CLASS_COUNT); |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1160 |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1161 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1162 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
|
1163 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1164 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
|
1165 AbortGeneratingWorld(); |
17976
776acb0fd15e
(svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress
rubidium <rubidium@openttd.org>
parents:
17960
diff
changeset
|
1166 } else if (HasModalProgress() && !IsGeneratingWorldAborted()) { |
5668
3d6d9bff3dd8
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138 <peter1138@openttd.org>
parents:
5587
diff
changeset
|
1167 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
|
1168 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1169 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1170 |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1171 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
|
1172 |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
1173 GenerateProgressWindow() : Window(&_generate_progress_desc) |
9333
5236ba6c7d54
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents:
9317
diff
changeset
|
1174 { |
20335
cadf6aaa0573
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
frosch <frosch@openttd.org>
parents:
20145
diff
changeset
|
1175 this->InitNested(); |
9333
5236ba6c7d54
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents:
9317
diff
changeset
|
1176 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1177 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14346
diff
changeset
|
1178 virtual void OnClick(Point pt, int widget, int click_count) |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1179 { |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1180 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1181 case WID_GP_ABORT: |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1182 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
|
1183 ShowQuery( |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1184 STR_GENERATION_ABORT_CAPTION, |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1185 STR_GENERATION_ABORT_MESSAGE, |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1186 this, |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1187 AbortGeneratingWorldCallback |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1188 ); |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1189 break; |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1190 } |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1191 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1192 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1193 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
|
1194 { |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1195 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1196 case WID_GP_PROGRESS_BAR: { |
19868
9c28125866da
(svn r24801) -Codechange: Add functions to set integral DParams to suitable values for size computations.
frosch <frosch@openttd.org>
parents:
19814
diff
changeset
|
1197 SetDParamMaxValue(0, 100); |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1198 *size = GetStringBoundingBox(STR_GENERATION_PROGRESS); |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1199 /* 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
|
1200 size->height += 8; |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1201 size->width += 8; |
15618
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15537
diff
changeset
|
1202 break; |
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15537
diff
changeset
|
1203 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1204 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1205 case WID_GP_PROGRESS_TEXT: |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1206 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
|
1207 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
|
1208 } |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1209 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
|
1210 break; |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1211 } |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1212 } |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1213 |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1214 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
|
1215 { |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1216 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1217 case WID_GP_PROGRESS_BAR: |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1218 /* 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
|
1219 DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY); |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1220 DrawFrameRect(r.left + 1, r.top + 1, (int)((r.right - r.left - 2) * _gws.percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE); |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1221 SetDParam(0, _gws.percent); |
15400
821c26b30fd9
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
alberth <alberth@openttd.org>
parents:
15238
diff
changeset
|
1222 DrawString(r.left, r.right, r.top + 5, STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER); |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1223 break; |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1224 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1225 case WID_GP_PROGRESS_TEXT: |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1226 /* Tell which class we are generating */ |
15400
821c26b30fd9
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
alberth <alberth@openttd.org>
parents:
15238
diff
changeset
|
1227 DrawString(r.left, r.right, r.top, _gws.cls, TC_FROMSTRING, SA_HOR_CENTER); |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1228 |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1229 /* And say where we are in that class */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1230 SetDParam(0, _gws.current); |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1231 SetDParam(1, _gws.total); |
15400
821c26b30fd9
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
alberth <alberth@openttd.org>
parents:
15238
diff
changeset
|
1232 DrawString(r.left, r.right, r.top + FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL, STR_GENERATION_PROGRESS_NUM, TC_FROMSTRING, SA_HOR_CENTER); |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1233 } |
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 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1235 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1236 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1237 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1238 * 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
|
1239 */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
1240 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
|
1241 { |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1242 _gws.cls = STR_GENERATION_WORLD_GENERATION; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1243 _gws.current = 0; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1244 _gws.total = 0; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1245 _gws.percent = 0; |
15820
59fd8293b2ee
(svn r20499) -Doc: Spelling fixes, and one doxygen comment addition.
alberth <alberth@openttd.org>
parents:
15744
diff
changeset
|
1246 _gws.timer = 0; // Forces to paint the progress window immediately |
5584
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 |
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 * 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
|
1251 */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
1252 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
|
1253 { |
17980
6c4dd98f3490
(svn r22789) -Codechange: rename generation window class to modal progress
rubidium <rubidium@openttd.org>
parents:
17979
diff
changeset
|
1254 if (BringWindowToFrontById(WC_MODAL_PROGRESS, 0)) return; |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1255 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
|
1256 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1257 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1258 static void _SetGeneratingWorldProgress(GenWorldProgress cls, uint progress, uint total) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1259 { |
18763
10757b027360
(svn r23611) -Add: run the begin of the script already while generating, and don't sleep on DoCommand while doing so
truebrain <truebrain@openttd.org>
parents:
18731
diff
changeset
|
1260 static const int percent_table[] = {0, 5, 14, 17, 20, 40, 60, 65, 80, 85, 95, 99, 100 }; |
17959
f3113a29d867
(svn r22768) -Add: progress bar updates for river building
rubidium <rubidium@openttd.org>
parents:
17958
diff
changeset
|
1261 assert_compile(lengthof(percent_table) == GWP_CLASS_COUNT + 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
|
1262 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
|
1263 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1264 /* 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
|
1265 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
|
1266 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1267 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
|
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 if (total == 0) { |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1270 assert(_gws.cls == _generation_class_table[cls]); |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1271 _gws.current += progress; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1272 assert(_gws.current <= _gws.total); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1273 } else { |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1274 _gws.cls = _generation_class_table[cls]; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1275 _gws.current = progress; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1276 _gws.total = total; |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1277 _gws.percent = percent_table[cls]; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1278 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1279 |
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
|
1280 /* Don't update the screen too often. So update it once in every once in a while... */ |
17978
6bba1c18478c
(svn r22787) -Codechange: rename genworld redraw constant
rubidium <rubidium@openttd.org>
parents:
17977
diff
changeset
|
1281 if (!_network_dedicated && _gws.timer != 0 && _realtime_tick - _gws.timer < MODAL_PROGRESS_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
|
1282 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1283 /* Percentage is about the number of completed tasks, so 'current - 1' */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1284 _gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1285 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1286 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
|
1287 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
|
1288 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1289 /* Never display 0% */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1290 if (_gws.percent == 0) return; |
9950
dbf95da604b3
(svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents:
9910
diff
changeset
|
1291 /* Reset if percent is lower than the last recorded */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1292 if (_gws.percent < last_percent) last_percent = 0; |
9950
dbf95da604b3
(svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents:
9910
diff
changeset
|
1293 /* Display every 5%, but 6% is also very valid.. just not smaller steps than 5% */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1294 if (_gws.percent % 5 != 0 && _gws.percent <= last_percent + 5) return; |
9950
dbf95da604b3
(svn r14105) -Fix: Some typos that are more grammatical errors, as it seems.
belugas <belugas@openttd.org>
parents:
9910
diff
changeset
|
1295 /* Never show steps smaller than 2%, even if it is a mod 5% */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1296 if (_gws.percent <= last_percent + 2) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1297 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1298 DEBUG(net, 1, "Map generation percentage complete: %d", _gws.percent); |
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1299 last_percent = _gws.percent; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
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 /* 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
|
1302 return; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1303 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1304 |
17980
6c4dd98f3490
(svn r22789) -Codechange: rename generation window class to modal progress
rubidium <rubidium@openttd.org>
parents:
17979
diff
changeset
|
1305 SetWindowDirty(WC_MODAL_PROGRESS, 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
|
1306 MarkWholeScreenDirty(); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1307 |
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
|
1308 /* 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
|
1309 * 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
|
1310 * 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
|
1311 * before we reacquire the mapgen rights */ |
17977
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1312 _modal_progress_work_mutex->EndCritical(); |
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1313 _modal_progress_paint_mutex->BeginCritical(); |
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1314 _modal_progress_work_mutex->BeginCritical(); |
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1315 _modal_progress_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
|
1316 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1317 _gws.timer = _realtime_tick; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
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 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1320 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1321 * 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
|
1322 * @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
|
1323 * @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
|
1324 * |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1325 * 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
|
1326 * 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
|
1327 */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1328 void SetGeneratingWorldProgress(GenWorldProgress cls, uint total) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1329 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1330 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
|
1331 |
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
|
1332 _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
|
1333 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1334 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1335 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1336 * 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
|
1337 * @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
|
1338 * |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1339 * 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
|
1340 * 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
|
1341 */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1342 void IncreaseGeneratingWorldProgress(GenWorldProgress cls) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1343 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1344 /* 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
|
1345 _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
|
1346 } |