Mercurial > hg > openttd
annotate src/genworld_gui.cpp @ 19793:012a8beddd97 draft
(svn r24726) -Codechange: Move editbox mouseloop handling to Window class.
author | frosch <frosch@openttd.org> |
---|---|
date | Tue, 13 Nov 2012 21:46:33 +0000 |
parents | f4775b6fb1d0 |
children | d06d57367979 |
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), |
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
|
81 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
|
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), |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
95 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_X_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
96 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
|
97 NWidget(WWT_DROPDOWN, COLOUR_ORANGE, WID_GL_MAPSIZE_Y_PULLDOWN), SetDataTip(STR_JUST_INT, STR_NULL), SetFill(1, 0), |
13496
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
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), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
102 NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_GL_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), |
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), |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
220 NWidget(WWT_EDITBOX, COLOUR_WHITE, WID_GL_RANDOM_EDITBOX), SetDataTip(STR_MAPGEN_RANDOM_SEED_OSKTITLE, STR_MAPGEN_RANDOM_SEED_HELP), SetFill(1, 1), |
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 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
266 SndPlayFx(SND_15_BEEP); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
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 |
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
|
306 struct GenerateLandscapeWindow : public QueryStringBaseWindow { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
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; |
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
|
312 |
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
|
313 GenerateLandscapeWindow(const WindowDesc *desc, WindowNumber number = 0) : QueryStringBaseWindow(11) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
314 { |
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
|
315 this->InitNested(desc, number); |
dec4ce746e13
(svn r18012) -Codechange: make the world generation windows nested; they'll need some tweaks to use the full potential though
rubidium <rubidium@openttd.org>
parents:
13490
diff
changeset
|
316 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
317 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
|
318 |
10276
a5286e772120
(svn r14514) -Codechange: use 'size' instead of 'length' for querystring and textbuf, explicitly say it includes the terminating zero
smatz <smatz@openttd.org>
parents:
10180
diff
changeset
|
319 /* snprintf() always outputs trailing '\0', so whole buffer can be used */ |
9897
5b558ce6cb0e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents:
9648
diff
changeset
|
320 snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed); |
19421
904203312f04
(svn r24324) -Codechange: Turn functions dealing with Textbufs into member functions.
frosch <frosch@openttd.org>
parents:
18891
diff
changeset
|
321 this->text.Initialize(this->edit_str_buf, this->edit_str_size); |
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
|
322 this->caption = STR_NULL; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
323 this->afilter = CS_NUMERAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
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: |
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
|
452 SetDParam(0, MAX_MAP_SIZE); |
13496
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
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: |
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
|
457 SetDParam(0, MAX_TILE_HEIGHT); |
13496
8eae44ae8187
(svn r18015) -Codechange: redesign the world generation windows to make 'proper' use of nested widgets.
rubidium <rubidium@openttd.org>
parents:
13493
diff
changeset
|
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; |
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
|
469 SetDParam(0, CUSTOM_TOWN_MAX_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
|
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; |
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
|
479 SetDParam(0, 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
|
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(); |
9897
5b558ce6cb0e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents:
9648
diff
changeset
|
552 snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed); |
19421
904203312f04
(svn r24324) -Codechange: Turn functions dealing with Textbufs into member functions.
frosch <frosch@openttd.org>
parents:
18891
diff
changeset
|
553 this->text.UpdateSize(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
554 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
|
555 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
|
556 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
557 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
|
558 /* 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
564 } else { |
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
565 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
|
566 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
|
567 } |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
568 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
|
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_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
|
571 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
|
572 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
|
573 ShowQuery( |
12632
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_CAPTION, |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
575 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
|
576 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
|
577 LandscapeGenerationCallback); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
578 } 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
|
579 StartGeneratingLandscape(mode); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
580 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
581 break; |
17817
96d8e7be4116
(svn r22608) -Fix[FS#4663]: Use rotated heightmap sizes for reporting scaling problems.
alberth <alberth@openttd.org>
parents:
17640
diff
changeset
|
582 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
583 |
18683
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_DOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
585 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
|
586 /* 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
|
587 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
|
588 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
|
589 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
590 _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
|
591 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
|
592 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 _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
|
594 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
595 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
596 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 |
18683
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_DOWN: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
603 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
|
604 /* 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
|
605 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
|
606 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
|
607 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
608 _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
|
609 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
|
610 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 _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
|
612 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
|
613 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
614 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
|
615 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
|
616 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
|
617 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
|
618 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
|
619 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
620 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
|
621 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
|
622 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
623 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
624 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
|
625 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
|
626 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
|
627 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
628 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
|
629 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
|
630 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
|
631 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
632 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
|
633 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
|
634 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
635 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
636 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
|
637 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
|
638 /* 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
|
639 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
|
640 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
|
641 } |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
642 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
|
643 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
|
644 } |
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
|
645 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
646 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
|
647 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
|
648 break; |
586f6c8f1eba
(svn r22767) -Add: river generation
rubidium <rubidium@openttd.org>
parents:
17817
diff
changeset
|
649 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
650 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
|
651 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
|
652 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
|
653 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
654 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
|
655 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
|
656 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
|
657 |
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
|
658 /* 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
|
659 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
|
660 _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
|
661 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
|
662 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
|
663 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
664 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
|
665 _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
|
666 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
|
667 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
|
668 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
669 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
|
670 _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
|
671 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
|
672 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
|
673 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
674 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
|
675 _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
|
676 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
|
677 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
|
678 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
679 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
|
680 _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
|
681 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
|
682 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
|
683 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
684 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
685 |
12739
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
686 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
|
687 { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
688 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
|
689 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
|
690 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
|
691 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
|
692 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
|
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 } |
2d764711d51b
(svn r17205) -Fix (r17175): Make year and snow line up/down buttons raise again.
alberth <alberth@openttd.org>
parents:
12632
diff
changeset
|
696 |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
697 virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
698 { |
15491
75c1b689c18c
(svn r20140) -Fix: Initialize the state of OnKeyPress at the world generation window (Zuu).
terkhen <terkhen@openttd.org>
parents:
15400
diff
changeset
|
699 EventState state = ES_NOT_HANDLED; |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
700 this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
701 /* the seed is unsigned, therefore atoi cannot be used. |
11361
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11347
diff
changeset
|
702 * As UINT32_MAX is a 'magic' value (use random seed) it |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11347
diff
changeset
|
703 * should not be possible to be entered into the input |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11347
diff
changeset
|
704 * field; the generate seed button can be used instead. */ |
9605
9ea90d50b73c
(svn r13647) -Codechange: replace MAX_UVALUE() for std types with the equivalent constant
skidd13 <skidd13@openttd.org>
parents:
9516
diff
changeset
|
705 _settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), UINT32_MAX - 1); |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
706 return state; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
707 } |
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
|
708 |
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
|
709 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
|
710 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
711 switch (widget) { |
18683
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_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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
721 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
|
722 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
|
723 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
|
724 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
|
725 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
|
726 } |
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
|
727 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
|
728 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
|
729 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
730 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
|
731 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
|
732 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
733 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
734 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
|
735 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
|
736 _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
|
737 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
|
738 _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
|
739 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
|
740 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
741 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
742 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
|
743 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
|
744 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
|
745 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
|
746 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
|
747 } |
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
|
748 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
|
749 _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
|
750 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
|
751 _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
|
752 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
|
753 } |
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 } |
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
|
755 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
|
756 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
758 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
|
759 { |
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
|
760 /* 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
|
761 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
|
762 |
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 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
|
764 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
|
765 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
|
766 } 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
|
767 /* 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
|
768 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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 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
|
774 } |
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 } |
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
|
776 |
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
|
777 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
|
778 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
|
779 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
|
780 _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
|
781 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
|
782 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
783 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
|
784 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
|
785 _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
|
786 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
787 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
788 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
|
789 _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
|
790 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
|
791 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
792 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
|
793 _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
|
794 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
|
795 } |
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
|
796 |
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
|
797 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
|
798 } |
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
|
799 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
800 |
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
|
801 static const WindowDesc _generate_landscape_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
802 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5892
diff
changeset
|
803 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
|
804 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
805 _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
|
806 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
807 |
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
|
808 static const WindowDesc _heightmap_load_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
809 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5892
diff
changeset
|
810 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
|
811 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
812 _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
|
813 ); |
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 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
815 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
|
816 { |
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
|
817 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
|
818 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
|
819 |
5901
6715d3646509
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents:
5899
diff
changeset
|
820 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
|
821 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
822 /* 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
|
823 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
|
824 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
825 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
|
826 /* 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
|
827 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
|
828 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
829 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
830 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
|
831 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
832 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
|
833 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
|
834 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
|
835 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
|
836 } |
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
|
837 |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
12849
diff
changeset
|
838 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
|
839 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
840 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
841 /** Start with a normal game. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
842 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
|
843 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
844 _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
|
845 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
846 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
847 /** Start with loading a heightmap. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
848 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
|
849 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
850 _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
|
851 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
852 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
853 /** Start with a scenario editor. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
854 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
|
855 { |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
856 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
|
857 } |
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
|
858 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
859 /** |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
860 * Start a normal game without the GUI. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
861 * @param seed The seed of the new game. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
862 */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
863 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
|
864 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
865 /* 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
|
866 _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
|
867 |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
868 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
|
869 } |
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 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
|
872 { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
873 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
|
874 |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
875 CreateScenarioWindow(const WindowDesc *desc, WindowNumber window_number) : Window() |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
876 { |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
877 this->InitNested(desc, window_number); |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
878 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
|
879 } |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
880 |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
881 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
|
882 { |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
883 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
884 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
|
885 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
|
886 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
887 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
888 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
|
889 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
|
890 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
891 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
892 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
|
893 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
|
894 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
895 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
896 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
|
897 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
|
898 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
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 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
901 |
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
|
902 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
|
903 { |
18683
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_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
|
905 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
|
906 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
|
907 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
|
908 |
18683
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_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
|
910 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
|
911 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
|
912 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
|
913 |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
914 this->DrawWidgets(); |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
915 } |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
916 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
917 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
|
918 { |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
919 StringID str = STR_JUST_INT; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
920 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
921 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
|
922 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
|
923 str = STR_BLACK_DATE_LONG; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
924 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
|
925 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
926 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
|
927 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
|
928 SetDParam(0, MAX_MAP_SIZE); |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
929 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
930 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
931 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
|
932 SetDParam(0, MAX_TILE_HEIGHT); |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
933 break; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
934 |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
935 default: |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
936 return; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
937 } |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
938 *size = GetStringBoundingBox(str); |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
939 size->width += padding.width; |
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
940 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
|
941 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14346
diff
changeset
|
943 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
|
944 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
945 switch (widget) { |
18683
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_TEMPERATE: |
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_ARCTIC: |
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
948 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
|
949 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
|
950 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
|
951 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
|
952 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
|
953 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
954 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
|
955 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
|
956 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
957 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
958 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
|
959 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
|
960 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
961 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
962 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
|
963 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
|
964 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
|
965 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
966 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
|
967 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
|
968 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
969 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
970 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
|
971 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
|
972 /* 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
|
973 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
|
974 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
|
975 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
|
976 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
977 _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
|
978 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
979 _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
|
980 break; |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
981 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
982 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
|
983 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
|
984 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
|
985 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
|
986 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
|
987 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
988 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
|
989 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
|
990 /* 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
|
991 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
|
992 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
|
993 this->SetDirty(); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
994 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
995 _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
|
996 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 _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
|
998 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
|
999 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1000 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
|
1001 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
|
1002 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
|
1003 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
|
1004 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
|
1005 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1006 } |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1007 |
13585
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1008 virtual void OnTimeout() |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1009 { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1010 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
|
1011 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
|
1012 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
|
1013 this->RaiseWidget(*widget); |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1014 this->SetWidgetDirty(*widget); |
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 } |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1017 } |
2d12e2247813
(svn r18109) -Fix: Up-/down-buttons of CreateScenarioWindow were not raised again.
frosch <frosch@openttd.org>
parents:
13564
diff
changeset
|
1018 |
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
|
1019 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
|
1020 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1021 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1022 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
|
1023 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
|
1024 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1025 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
|
1026 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1027 |
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
|
1028 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
|
1029 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9164
diff
changeset
|
1030 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
|
1031 int32 value = atoi(str); |
8355
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1032 |
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
|
1033 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
|
1034 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
|
1035 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
|
1036 _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
|
1037 break; |
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1038 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1039 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
|
1040 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
|
1041 _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
|
1042 break; |
73ad124db503
(svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents:
8353
diff
changeset
|
1043 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1044 |
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
|
1045 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
|
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 } |
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
|
1048 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1049 |
11537
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1050 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
|
1051 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
|
1052 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
|
1053 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
|
1054 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
|
1055 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
|
1056 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
|
1057 /* Landscape style selection. */ |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
1058 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
|
1059 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
|
1060 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
|
1061 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
|
1062 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
|
1063 EndContainer(), |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
1064 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
|
1065 /* 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
|
1066 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
|
1067 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
|
1068 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
|
1069 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1070 /* Labels + setting drop-downs */ |
13490
369cd73e98d3
(svn r18009) -Codechange: make the 'create scenario' window nested
rubidium <rubidium@openttd.org>
parents:
13487
diff
changeset
|
1071 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
|
1072 /* Map size. */ |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1073 NWidget(NWID_HORIZONTAL), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
1074 NWidget(WWT_TEXT, COLOUR_ORANGE), SetDataTip(STR_MAPGEN_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
|
1075 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
|
1076 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
|
1077 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
|
1078 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
|
1079 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1080 /* Date. */ |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1081 NWidget(NWID_HORIZONTAL), |
13755
bf8a4ced15fe
(svn r18280) -Codechange: remove widget indices that are not needed for custom drawing/handling input
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
1082 NWidget(WWT_TEXT, COLOUR_ORANGE), 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
|
1083 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
|
1084 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
|
1085 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
|
1086 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
|
1087 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1088 /* Flat map height. */ |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1089 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
|
1090 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
|
1091 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
|
1092 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
|
1093 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
|
1094 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
|
1095 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
|
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 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1099 EndContainer(), |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1100 }; |
ed03b8609ef7
(svn r15898) -Codechange: Added nested widgets for create-scenrario window
alberth <alberth@openttd.org>
parents:
11536
diff
changeset
|
1101 |
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
|
1102 static const WindowDesc _create_scenario_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
1103 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5892
diff
changeset
|
1104 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
|
1105 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
1106 _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
|
1107 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1108 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
17581
diff
changeset
|
1109 /** Show the window to create a scenario. */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
1110 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
|
1111 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1112 DeleteWindowByClass(WC_GENERATE_LANDSCAPE); |
14307
f0ad75f914d1
(svn r18859) -Codechange: rename glwp_modes to GenenerateLandscapeWindowMode
smatz <smatz@openttd.org>
parents:
14301
diff
changeset
|
1113 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
|
1114 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1115 |
11521
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1116 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
|
1117 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
|
1118 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
|
1119 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
|
1120 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
|
1121 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
|
1122 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
|
1123 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
|
1124 EndContainer(), |
11521
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1125 EndContainer(), |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1126 EndContainer(), |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1127 }; |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1128 |
7a2bb2bb8fce
(svn r15882) -Codechange: New widgets for generation progress window.
alberth <alberth@openttd.org>
parents:
11450
diff
changeset
|
1129 |
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
|
1130 static const WindowDesc _generate_progress_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
1131 WDP_CENTER, 0, 0, |
17980
6c4dd98f3490
(svn r22789) -Codechange: rename generation window class to modal progress
rubidium <rubidium@openttd.org>
parents:
17979
diff
changeset
|
1132 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
|
1133 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13509
diff
changeset
|
1134 _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
|
1135 ); |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1136 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1137 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
|
1138 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
|
1139 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
|
1140 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
|
1141 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
|
1142 int timer; |
6248
0789677a15a0
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents:
6247
diff
changeset
|
1143 }; |
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 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
|
1146 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1147 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
|
1148 STR_GENERATION_WORLD_GENERATION, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1149 STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION, |
17959
f3113a29d867
(svn r22768) -Add: progress bar updates for river building
rubidium <rubidium@openttd.org>
parents:
17958
diff
changeset
|
1150 STR_GENERATION_RIVER_GENERATION, |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1151 STR_GENERATION_CLEARING_TILES, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1152 STR_SCENEDIT_TOOLBAR_TOWN_GENERATION, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1153 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
|
1154 STR_GENERATION_OBJECT_GENERATION, |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1155 STR_GENERATION_TREE_GENERATION, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1156 STR_GENERATION_SETTINGUP_GAME, |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1157 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
|
1158 STR_GENERATION_PREPARING_SCRIPT, |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1159 STR_GENERATION_PREPARING_GAME |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1160 }; |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1161 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
|
1162 |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1163 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1164 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
|
1165 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1166 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
|
1167 AbortGeneratingWorld(); |
17976
776acb0fd15e
(svn r22785) -Codechange: rename IsGeneratingWorld to HasModalProgress
rubidium <rubidium@openttd.org>
parents:
17960
diff
changeset
|
1168 } 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
|
1169 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
|
1170 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1171 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1172 |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1173 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
|
1174 |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1175 GenerateProgressWindow() : Window() |
9333
5236ba6c7d54
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents:
9317
diff
changeset
|
1176 { |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1177 this->InitNested(&_generate_progress_desc); |
9333
5236ba6c7d54
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138 <peter1138@openttd.org>
parents:
9317
diff
changeset
|
1178 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1179 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14346
diff
changeset
|
1180 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
|
1181 { |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1182 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1183 case WID_GP_ABORT: |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1184 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
|
1185 ShowQuery( |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1186 STR_GENERATION_ABORT_CAPTION, |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1187 STR_GENERATION_ABORT_MESSAGE, |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1188 this, |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1189 AbortGeneratingWorldCallback |
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 break; |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1192 } |
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1193 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1194 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1195 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1196 { |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1197 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1198 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
|
1199 SetDParam(0, 100); |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1200 *size = GetStringBoundingBox(STR_GENERATION_PROGRESS); |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1201 /* We need some spacing for the 'border' */ |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1202 size->height += 8; |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1203 size->width += 8; |
15618
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15537
diff
changeset
|
1204 break; |
e4640748f223
(svn r20281) -Codechange: unify case scope closure + break coding style
rubidium <rubidium@openttd.org>
parents:
15537
diff
changeset
|
1205 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1206 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1207 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
|
1208 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
|
1209 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
|
1210 } |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1211 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
|
1212 break; |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1213 } |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1214 } |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1215 |
13487
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1216 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
|
1217 { |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1218 switch (widget) { |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1219 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
|
1220 /* 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
|
1221 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
|
1222 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
|
1223 SetDParam(0, _gws.percent); |
15400
821c26b30fd9
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
alberth <alberth@openttd.org>
parents:
15238
diff
changeset
|
1224 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
|
1225 break; |
9266
3108515a123e
(svn r13132) -Codechange: make a class of the GenerateProgressWindow.
glx <glx@openttd.org>
parents:
9203
diff
changeset
|
1226 |
18683
20868d80cd57
(svn r23531) -Codechange: document and rename widgets to be consistent and understandable
truebrain <truebrain@openttd.org>
parents:
18680
diff
changeset
|
1227 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
|
1228 /* Tell which class we are generating */ |
15400
821c26b30fd9
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
alberth <alberth@openttd.org>
parents:
15238
diff
changeset
|
1229 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
|
1230 |
4ff75a36a676
(svn r18006) -Codechange: make the world generation progress window nested
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1231 /* 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
|
1232 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
|
1233 SetDParam(1, _gws.total); |
15400
821c26b30fd9
(svn r20043) -Codechange: Introduce vertical alignment for DrawStringMultiLine().
alberth <alberth@openttd.org>
parents:
15238
diff
changeset
|
1234 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
|
1235 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1236 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1237 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1238 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1239 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1240 * 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
|
1241 */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
1242 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
|
1243 { |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1244 _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
|
1245 _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
|
1246 _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
|
1247 _gws.percent = 0; |
15820
59fd8293b2ee
(svn r20499) -Doc: Spelling fixes, and one doxygen comment addition.
alberth <alberth@openttd.org>
parents:
15744
diff
changeset
|
1248 _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
|
1249 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1250 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1251 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1252 * 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
|
1253 */ |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
6179
diff
changeset
|
1254 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
|
1255 { |
17980
6c4dd98f3490
(svn r22789) -Codechange: rename generation window class to modal progress
rubidium <rubidium@openttd.org>
parents:
17979
diff
changeset
|
1256 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
|
1257 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
|
1258 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1259 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1260 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
|
1261 { |
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
|
1262 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
|
1263 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
|
1264 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
|
1265 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1266 /* 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
|
1267 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
|
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 (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
|
1270 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1271 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
|
1272 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
|
1273 _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
|
1274 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
|
1275 } else { |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1276 _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
|
1277 _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
|
1278 _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
|
1279 _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
|
1280 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1281 |
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
|
1282 /* 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
|
1283 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
|
1284 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1285 /* 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
|
1286 _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
|
1287 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1288 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
|
1289 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
|
1290 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1291 /* 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
|
1292 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
|
1293 /* 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
|
1294 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
|
1295 /* 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
|
1296 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
|
1297 /* 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
|
1298 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
|
1299 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1300 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
|
1301 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
|
1302 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1303 /* 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
|
1304 return; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1305 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1306 |
17980
6c4dd98f3490
(svn r22789) -Codechange: rename generation window class to modal progress
rubidium <rubidium@openttd.org>
parents:
17979
diff
changeset
|
1307 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
|
1308 MarkWholeScreenDirty(); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1309 |
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
|
1310 /* 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
|
1311 * 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
|
1312 * 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
|
1313 * 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
|
1314 _modal_progress_work_mutex->EndCritical(); |
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1315 _modal_progress_paint_mutex->BeginCritical(); |
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1316 _modal_progress_work_mutex->BeginCritical(); |
678cb42fdc25
(svn r22786) -Codechange: rename genworld mutices to model_progress mutices
rubidium <rubidium@openttd.org>
parents:
17976
diff
changeset
|
1317 _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
|
1318 |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1319 _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
|
1320 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1321 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1322 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1323 * 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
|
1324 * @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
|
1325 * @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
|
1326 * |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1327 * 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
|
1328 * 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
|
1329 */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1330 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
|
1331 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1332 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
|
1333 |
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
|
1334 _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
|
1335 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1336 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1337 /** |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1338 * 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
|
1339 * @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
|
1340 * |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1341 * 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
|
1342 * 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
|
1343 */ |
14301
70d2b51a40ae
(svn r18853) -Codechange: apply coding style to GenWorld's enums, structs and typedefs
smatz <smatz@openttd.org>
parents:
14298
diff
changeset
|
1344 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
|
1345 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1346 /* 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
|
1347 _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
|
1348 } |