annotate src/genworld_gui.cpp @ 8355:73ad124db503 draft

(svn r11921) -Cleanup: correct indenting and switch case line spacing.
author peter1138 <peter1138@openttd.org>
date Fri, 18 Jan 2008 21:33:19 +0000
parents 6fb24ab5c935
children 17e30bf8f359
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1 /* $Id$ */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2
6179
e3e61b92574b (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents: 5901
diff changeset
3 /** @file genworld_gui.cpp */
e3e61b92574b (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents: 5901
diff changeset
4
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
5 #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
6 #include "openttd.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
7 #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
8 #include "gui.h"
8107
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
9 #include "window_gui.h"
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
10 #include "textbuf_gui.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
11 #include "gfxinit.h"
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents: 8114
diff changeset
12 #include "command_func.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
13 #include "variables.h"
8208
ddc34919158f (svn r11771) -Codechange: split settings.h into better separated headers.
rubidium <rubidium@openttd.org>
parents: 8157
diff changeset
14 #include "settings_func.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
15 #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
16 #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
17 #include "network/network.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
18 #include "thread.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
19 #include "newgrf_config.h"
8114
2d6af5d7a142 (svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents: 8108
diff changeset
20 #include "strings_func.h"
8131
e300ac8001ae (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents: 8121
diff changeset
21 #include "window_func.h"
8140
fb8a05d579da (svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents: 8131
diff changeset
22 #include "date_func.h"
8157
019833e42fda (svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium <rubidium@openttd.org>
parents: 8151
diff changeset
23 #include "sound_func.h"
8151
bee108a98a39 (svn r11713) -Codechange: Move some declarations and definitions in a more logical disposition
belugas <belugas@openttd.org>
parents: 8140
diff changeset
24 #include "fios.h"
8214
6385dffc0b37 (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium <rubidium@openttd.org>
parents: 8208
diff changeset
25 #include "string_func.h"
8224
c45446125bf0 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents: 8214
diff changeset
26 #include "gfx_func.h"
8270
5613b863190d (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium <rubidium@openttd.org>
parents: 8264
diff changeset
27 #include "settings_type.h"
8327
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
28 #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
29 #include "widgets/dropdown_func.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
30
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
31 #include "table/strings.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
32 #include "table/sprites.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
33
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
34 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
35 * In what 'mode' the GenerateLandscapeWindowProc is.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
36 */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
37 enum glwp_modes {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
38 GLWP_GENERATE,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
39 GLWP_HEIGHTMAP,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
40 GLWP_SCENARIO,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
41 GLWP_END
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
42 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
43
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
44 struct generate_d {
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
45 uint widget_id;
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
46 uint x;
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
47 uint y;
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
48 char name[64];
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
49 };
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
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
51 extern void SwitchMode(int new_mode);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
52
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
53 static inline void SetNewLandscapeType(byte landscape)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
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 _opt_newgame.landscape = landscape;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
56 InvalidateWindowClasses(WC_SELECT_GAME);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
57 InvalidateWindowClasses(WC_GENERATE_LANDSCAPE);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
58 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
59
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
60 enum GenerateLandscapeWindowWidgets {
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
61 GLAND_TEMPERATE = 3,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
62 GLAND_ARCTIC,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
63 GLAND_TROPICAL,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
64 GLAND_TOYLAND,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
65
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
66 GLAND_MAPSIZE_X_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
67 GLAND_MAPSIZE_X_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
68 GLAND_MAPSIZE_Y_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
69 GLAND_MAPSIZE_Y_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
70
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
71 GLAND_TOWN_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
72 GLAND_TOWN_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
73 GLAND_INDUSTRY_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
74 GLAND_INDUSTRY_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
75
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
76 GLAND_RANDOM_TEXT,
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
77 GLAND_RANDOM_EDITBOX,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
78 GLAND_RANDOM_BUTTON,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
79
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
80 GLAND_GENERATE_BUTTON,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
81
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
82 GLAND_START_DATE_TEXT1,
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
83 GLAND_START_DATE_DOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
84 GLAND_START_DATE_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
85 GLAND_START_DATE_UP,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
86
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
87 GLAND_SNOW_LEVEL_TEXT1,
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
88 GLAND_SNOW_LEVEL_DOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
89 GLAND_SNOW_LEVEL_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
90 GLAND_SNOW_LEVEL_UP,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
91
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
92 GLAND_TREE_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
93 GLAND_TREE_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
94 GLAND_LANDSCAPE_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
95 GLAND_LANDSCAPE_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
96 GLAND_HEIGHTMAP_ROTATION_TEXT = GLAND_LANDSCAPE_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
97 GLAND_HEIGHTMAP_ROTATION_PULLDOWN = GLAND_LANDSCAPE_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
98
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
99 GLAND_TERRAIN_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
100 GLAND_TERRAIN_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
101 GLAND_WATER_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
102 GLAND_WATER_PULLDOWN,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
103 GLAND_SMOOTHNESS_TEXT,
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
104 GLAND_SMOOTHNESS_PULLDOWN
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
105 };
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
106
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
107 static const Widget _generate_landscape_widgets[] = {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
108 { WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
109 { WWT_CAPTION, RESIZE_NONE, 13, 11, 337, 0, 13, STR_WORLD_GENERATION_CAPTION, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
110 { WWT_PANEL, RESIZE_NONE, 13, 0, 337, 14, 267, 0x0, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
111
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
112 { WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 24, 78, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
113 { WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 24, 78, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
114 { WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 24, 78, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
115 { WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 24, 78, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
116
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
117 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 91, 101, STR_MAPSIZE, STR_NULL},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
118 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 161, 90, 101, STR_NUM_1, STR_NULL}, // Mapsize X
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
119 { WWT_TEXT, RESIZE_NONE, 0, 168, 176, 91, 101, STR_BY, STR_NULL},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
120 { WWT_DROPDOWN, RESIZE_NONE, 12, 180, 227, 90, 101, STR_NUM_2, STR_NULL}, // Mapsize Y
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
121
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
122 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 113, 123, STR_NUMBER_OF_TOWNS, STR_NULL},
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
123 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 175, 112, 123, 0x0, STR_NULL}, // Number of towns
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
124
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
125 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 131, 141, STR_NUMBER_OF_INDUSTRIES, STR_NULL},
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
126 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 175, 130, 141, 0x0, STR_NULL}, // Number of industries
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
127
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
128 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 153, 163, STR_RANDOM_SEED, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
129 { WWT_PANEL, RESIZE_NONE, 15, 114, 207, 152, 163, 0x0, STR_RANDOM_SEED_HELP}, // Edit box for seed
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
130 { WWT_TEXTBTN, RESIZE_NONE, 12, 216, 326, 152, 163, STR_RANDOM, STR_RANDOM_HELP},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
131
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
132 { WWT_TEXTBTN, RESIZE_NONE, 6, 243, 326, 228, 257, STR_GENERATE, STR_NULL}, // Generate button
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
133
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
134 { WWT_TEXT, RESIZE_NONE, 0, 182, 212, 113, 123, STR_DATE, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
135 { WWT_IMGBTN, RESIZE_NONE, 12, 216, 227, 112, 123, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
136 { WWT_TEXTBTN, RESIZE_NONE, 12, 228, 314, 112, 123, STR_GENERATE_DATE, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
137 { WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 112, 123, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
138
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
139 { WWT_TEXT, RESIZE_NONE, 0, 182, 278, 131, 141, STR_SNOW_LINE_HEIGHT, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
140 { WWT_IMGBTN, RESIZE_NONE, 12, 282, 293, 130, 141, SPR_ARROW_DOWN, STR_SNOW_LINE_DOWN},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
141 { WWT_TEXTBTN, RESIZE_NONE, 12, 294, 314, 130, 141, STR_NUM_3, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
142 { WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 130, 141, SPR_ARROW_UP, STR_SNOW_LINE_UP},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
143
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
144 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 193, 203, STR_TREE_PLACER, STR_NULL},
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
145 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 192, 203, 0x0, STR_NULL}, // Tree placer
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
146
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
147 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 175, 185, STR_LAND_GENERATOR, STR_NULL},
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
148 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 174, 185, 0x0, STR_NULL}, // Landscape generator
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
149
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
150 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 211, 221, STR_TERRAIN_TYPE, STR_NULL},
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
151 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 210, 221, 0x0, STR_NULL}, // Terrain type
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
152
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
153 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 229, 239, STR_QUANTITY_OF_SEA_LAKES, STR_NULL},
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
154 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 228, 239, 0x0, STR_NULL}, // Water quantity
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
155
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
156 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 245, 257, STR_SMOOTHNESS, STR_NULL},
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
157 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 246, 257, 0x0, STR_NULL}, // Map smoothness
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
158 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
159 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
160
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
161 static const Widget _heightmap_load_widgets[] = {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
162 { WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
163 { WWT_CAPTION, RESIZE_NONE, 13, 11, 337, 0, 13, STR_WORLD_GENERATION_CAPTION, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
164 { WWT_PANEL, RESIZE_NONE, 13, 0, 337, 14, 235, 0x0, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
165
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
166 { WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 24, 78, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
167 { WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 24, 78, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
168 { WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 24, 78, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
169 { WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 24, 78, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
170
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
171 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 113, 123, STR_MAPSIZE, STR_NULL},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
172 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 161, 112, 123, STR_NUM_1, STR_NULL}, // Mapsize X
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
173 { WWT_TEXT, RESIZE_NONE, 0, 168, 176, 113, 123, STR_BY, STR_NULL},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
174 { WWT_DROPDOWN, RESIZE_NONE, 12, 180, 227, 112, 123, STR_NUM_2, STR_NULL}, // Mapsize Y
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
175
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
176 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 135, 145, STR_NUMBER_OF_TOWNS, STR_NULL},
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
177 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 175, 134, 145, 0x0, STR_NULL}, // Number of towns
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
178
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
179 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 153, 163, STR_NUMBER_OF_INDUSTRIES, STR_NULL},
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
180 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 175, 152, 163, 0x0, STR_NULL}, // Number of industries
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
181
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
182 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 175, 185, STR_RANDOM_SEED, STR_NULL},
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
183 { WWT_PANEL, RESIZE_NONE, 15, 114, 207, 174, 185, 0x0, STR_RANDOM_SEED_HELP}, // Edit box for seed
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
184 { WWT_TEXTBTN, RESIZE_NONE, 12, 216, 326, 174, 185, STR_RANDOM, STR_RANDOM_HELP},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
185
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
186 { WWT_TEXTBTN, RESIZE_NONE, 6, 243, 326, 196, 225, STR_GENERATE, STR_NULL}, // Generate button
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
187
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
188 { WWT_TEXT, RESIZE_NONE, 0, 182, 212, 135, 145, STR_DATE, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
189 { WWT_IMGBTN, RESIZE_NONE, 12, 216, 227, 134, 145, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
190 { WWT_TEXTBTN, RESIZE_NONE, 12, 228, 314, 134, 145, STR_GENERATE_DATE, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
191 { WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 134, 145, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
192
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
193 { WWT_TEXT, RESIZE_NONE, 0, 182, 278, 153, 163, STR_SNOW_LINE_HEIGHT, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
194 { WWT_IMGBTN, RESIZE_NONE, 12, 282, 293, 152, 163, SPR_ARROW_DOWN, STR_SNOW_LINE_DOWN},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
195 { WWT_TEXTBTN, RESIZE_NONE, 12, 294, 314, 152, 163, STR_NUM_3, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
196 { WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 152, 163, SPR_ARROW_UP, STR_SNOW_LINE_UP},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
197
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
198 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 197, 207, STR_TREE_PLACER, STR_NULL},
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
199 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 196, 207, STR_0225, STR_NULL}, // Tree placer
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
200
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
201 { WWT_TEXT, RESIZE_NONE, 0, 12, 110, 215, 225, STR_HEIGHTMAP_ROTATION, STR_NULL},
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
202 { WWT_DROPDOWN, RESIZE_NONE, 12, 114, 231, 214, 225, STR_0225, STR_NULL}, // Heightmap rotation
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
203
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
204 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
205 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
206
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
207 void StartGeneratingLandscape(glwp_modes mode)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
208 {
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
209 DeleteAllNonVitalWindows();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
210
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
211 /* Copy all XXX_newgame to XXX when coming from outside the editor */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
212 UpdatePatches();
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
213 _opt = _opt_newgame;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
214 _opt_ptr = &_opt;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
215 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
216
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
217 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
218 switch (mode) {
5894
c4ab8176e02e (svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater <Darkvater@openttd.org>
parents: 5893
diff changeset
219 case GLWP_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break;
c4ab8176e02e (svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater <Darkvater@openttd.org>
parents: 5893
diff changeset
220 case GLWP_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break;
5899
71bc001a6dde (svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents: 5894
diff changeset
221 case GLWP_SCENARIO: _switch_mode = SM_EDITOR; break;
5894
c4ab8176e02e (svn r8512) -Codechange: From the intro window enter the scenario editor. From the scenario editor dialog, remove the 'load heightmap' option and put that with the other options like 'load scenario', 'save scenario', etc. Play a little bit with positioning of elements inside the scenario editor dialog so it looks better.
Darkvater <Darkvater@openttd.org>
parents: 5893
diff changeset
222 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
223 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
224 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
225
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
226 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
227 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
228 if (confirmed) StartGeneratingLandscape((glwp_modes)w->window_number);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
229 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
230
8327
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
231 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
232 {
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
233 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
234
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
235 for (uint i = 6; i <= 11; i++) {
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
236 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
237 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
238 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
239 }
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
240
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
241 return list;
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
242 }
b5058eea06a1 (svn r11893) -Codechange: build map size drop downs dynamically and remove unneeded strings
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
243
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
244 static void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
245 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
246 static const StringID elevations[] = {STR_682A_VERY_FLAT, STR_682B_FLAT, STR_682C_HILLY, STR_682D_MOUNTAINOUS, INVALID_STRING_ID};
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
247 static const StringID sea_lakes[] = {STR_VERY_LOW, STR_6820_LOW, STR_6821_MEDIUM, STR_6822_HIGH, INVALID_STRING_ID};
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
248 static const StringID smoothness[] = {STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_VERY_ROUGH, INVALID_STRING_ID};
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
249 static const StringID tree_placer[] = {STR_CONFIG_PATCHES_TREE_PLACER_NONE, STR_CONFIG_PATCHES_TREE_PLACER_ORIGINAL, STR_CONFIG_PATCHES_TREE_PLACER_IMPROVED, INVALID_STRING_ID};
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
250 static const StringID rotation[] = {STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID};
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
251 static const StringID landscape[] = {STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL, STR_CONFIG_PATCHES_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID};
6560
838badc858d3 (svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents: 6481
diff changeset
252 static const StringID num_towns[] = {STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
838badc858d3 (svn r9762) -Feature: Two new difficulty settings : Very low number of towns and very low number of industries
belugas <belugas@openttd.org>
parents: 6481
diff changeset
253 static const StringID num_inds[] = {STR_26816_NONE, STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
254
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
255 /* Data used for the generate seed edit box */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
256 static querystr_d _genseed_query;
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
257 static char _genseed_buffer[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
258
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
259 glwp_modes mode = (glwp_modes)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
260
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
261 switch (e->event) {
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
262 case WE_CREATE:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
263 w->LowerWidget(_opt_newgame.landscape + GLAND_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
264
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
265 snprintf(_genseed_buffer, sizeof(_genseed_buffer), "%u", _patches_newgame.generation_seed);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
266 InitializeTextBuffer(&_genseed_query.text, _genseed_buffer, lengthof(_genseed_buffer), 120);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
267 _genseed_query.caption = STR_NULL;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
268 _genseed_query.afilter = CS_NUMERAL;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
269 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
270
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
271 case WE_PAINT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
272 /* You can't select smoothness if not terragenesis */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
273 if (mode == GLWP_GENERATE) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
274 w->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
275 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
276 /* Disable snowline if not hilly */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
277 w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
278 /* Disable town, industry and trees in SE */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
279 w->SetWidgetDisabledState(GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
280 w->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
281 w->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
282
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
283 w->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
284 w->SetWidgetDisabledState(GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
285 w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
286 w->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= MAX_SNOWLINE_HEIGHT || _opt_newgame.landscape != LT_ARCTIC);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
287
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
288 w->SetWidgetLoweredState(GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
289 w->SetWidgetLoweredState(GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
290 w->SetWidgetLoweredState(GLAND_TROPICAL, _opt_newgame.landscape == LT_TROPIC);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
291 w->SetWidgetLoweredState(GLAND_TOYLAND, _opt_newgame.landscape == LT_TOYLAND);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
292
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
293 if (_game_mode == GM_EDITOR) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
294 w->widget[GLAND_TOWN_PULLDOWN].data = STR_6836_OFF;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
295 w->widget[GLAND_INDUSTRY_PULLDOWN].data = STR_6836_OFF;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
296 } else {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
297 w->widget[GLAND_TOWN_PULLDOWN].data = num_towns[_opt_newgame.diff.number_towns];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
298 w->widget[GLAND_INDUSTRY_PULLDOWN].data = num_inds[_opt_newgame.diff.number_industries];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
299 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
300
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
301 if (mode == GLWP_GENERATE) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
302 w->widget[GLAND_LANDSCAPE_PULLDOWN].data = landscape[_patches_newgame.land_generator];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
303 w->widget[GLAND_TREE_PULLDOWN].data = tree_placer[_patches_newgame.tree_placer];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
304 w->widget[GLAND_TERRAIN_PULLDOWN].data = elevations[_opt_newgame.diff.terrain_type];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
305 w->widget[GLAND_WATER_PULLDOWN].data = sea_lakes[_opt_newgame.diff.quantity_sea_lakes];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
306 w->widget[GLAND_SMOOTHNESS_PULLDOWN].data = smoothness[_patches_newgame.tgen_smoothness];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
307 } else {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
308 w->widget[GLAND_TREE_PULLDOWN].data = tree_placer[_patches_newgame.tree_placer];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
309 w->widget[GLAND_HEIGHTMAP_ROTATION_PULLDOWN].data = rotation[_patches_newgame.heightmap_rotation];
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
310 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
311
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
312 /* Set parameters for widget text that requires them. */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
313 SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); // GLAND_START_DATE_TEXT
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
314 SetDParam(1, 1 << _patches_newgame.map_x); // GLAND_MAPSIZE_X_PULLDOWN
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
315 SetDParam(2, 1 << _patches_newgame.map_y); // GLAND_MAPSIZE_Y_PULLDOWN
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
316 SetDParam(3, _patches_newgame.snow_line_height); // GLAND_SNOW_LEVEL_TEXT
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
317
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
318 DrawWindowWidgets(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
319
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
320 DrawEditBox(w, &_genseed_query, GLAND_RANDOM_EDITBOX);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
321
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
322 if (mode != GLWP_GENERATE) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
323 char buffer[512];
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
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
325 if (_patches_newgame.heightmap_rotation == HM_CLOCKWISE) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
326 SetDParam(0, WP(w, generate_d).y);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
327 SetDParam(1, WP(w, generate_d).x);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
328 } else {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
329 SetDParam(0, WP(w, generate_d).x);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
330 SetDParam(1, WP(w, generate_d).y);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
331 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
332 GetString(buffer, STR_HEIGHTMAP_SIZE, lastof(buffer));
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
333 DrawStringRightAligned(326, 91, STR_HEIGHTMAP_SIZE, TC_BLACK);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
334
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
335 DrawString( 12, 91, STR_HEIGHTMAP_NAME, TC_BLACK);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
336 SetDParamStr(0, WP(w, generate_d).name);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
337 DrawStringTruncated(114, 91, STR_ORANGE, TC_BLACK, 326 - 114 - GetStringBoundingBox(buffer).width - 5);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
338 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
339 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
340
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
341 case WE_CLICK:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
342 switch (e->we.click.widget) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
343 case 0: DeleteWindow(w); 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
344
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
345 case GLAND_TEMPERATE:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
346 case GLAND_ARCTIC:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
347 case GLAND_TROPICAL:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
348 case GLAND_TOYLAND:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
349 w->RaiseWidget(_opt_newgame.landscape + GLAND_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
350 SetNewLandscapeType(e->we.click.widget - GLAND_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
351 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
352
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
353 case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
354 ShowDropDownList(w, BuildMapsizeDropDown(), _patches_newgame.map_x, GLAND_MAPSIZE_X_PULLDOWN);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
355 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
356
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
357 case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
358 ShowDropDownList(w, BuildMapsizeDropDown(), _patches_newgame.map_y, GLAND_MAPSIZE_Y_PULLDOWN);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
359 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
360
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
361 case GLAND_TOWN_PULLDOWN: // Number of towns
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
362 ShowDropDownMenu(w, num_towns, _opt_newgame.diff.number_towns, GLAND_TOWN_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
363 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
364
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
365 case GLAND_INDUSTRY_PULLDOWN: // Number of industries
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
366 ShowDropDownMenu(w, num_inds, _opt_newgame.diff.number_industries, GLAND_INDUSTRY_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
367 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
368
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
369 case GLAND_RANDOM_BUTTON: // Random seed
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
370 _patches_newgame.generation_seed = InteractiveRandom();
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
371 snprintf(_genseed_buffer, lengthof(_genseed_buffer), "%u", _patches_newgame.generation_seed);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
372 UpdateTextBufferSize(&_genseed_query.text);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
373 SetWindowDirty(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
374 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
375
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
376 case GLAND_GENERATE_BUTTON: // Generate
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
377
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
378 UpdatePatches();
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
379
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
380 if (_patches.town_layout == TL_NO_ROADS) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
381 ShowQuery(
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
382 STR_TOWN_LAYOUT_WARNING_CAPTION,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
383 STR_TOWN_LAYOUT_WARNING_MESSAGE,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
384 w,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
385 LandscapeGenerationCallback);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
386 } else if (mode == GLWP_HEIGHTMAP &&
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
387 (WP(w, generate_d).x * 2 < (1U << _patches_newgame.map_x) ||
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
388 WP(w, generate_d).x / 2 > (1U << _patches_newgame.map_x) ||
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
389 WP(w, generate_d).y * 2 < (1U << _patches_newgame.map_y) ||
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
390 WP(w, generate_d).y / 2 > (1U << _patches_newgame.map_y))) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
391 ShowQuery(
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
392 STR_HEIGHTMAP_SCALE_WARNING_CAPTION,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
393 STR_HEIGHTMAP_SCALE_WARNING_MESSAGE,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
394 w,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
395 LandscapeGenerationCallback);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
396 } else {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
397 StartGeneratingLandscape(mode);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
398 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
399 break;
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
400
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
401 case GLAND_START_DATE_DOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
402 case GLAND_START_DATE_UP: // Year buttons
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
403 /* Don't allow too fast scrolling */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
404 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
405 w->HandleButtonClick(e->we.click.widget);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
406 SetWindowDirty(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
407
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
408 _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
409 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
410 _left_button_clicked = false;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
411 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
412
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
413 case GLAND_START_DATE_TEXT: // Year text
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
414 WP(w, generate_d).widget_id = GLAND_START_DATE_TEXT;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
415 SetDParam(0, _patches_newgame.starting_year);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
416 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
417 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
418
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
419 case GLAND_SNOW_LEVEL_DOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
420 case GLAND_SNOW_LEVEL_UP: // Snow line buttons
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
421 /* Don't allow too fast scrolling */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
422 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
423 w->HandleButtonClick(e->we.click.widget);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
424 SetWindowDirty(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
425
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
426 _patches_newgame.snow_line_height = Clamp(_patches_newgame.snow_line_height + e->we.click.widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
427 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
428 _left_button_clicked = false;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
429 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
430
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
431 case GLAND_SNOW_LEVEL_TEXT: // Snow line text
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
432 WP(w, generate_d).widget_id = GLAND_SNOW_LEVEL_TEXT;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
433 SetDParam(0, _patches_newgame.snow_line_height);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
434 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, w, CS_NUMERAL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
435 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
436
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
437 case GLAND_TREE_PULLDOWN: // Tree placer
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
438 ShowDropDownMenu(w, tree_placer, _patches_newgame.tree_placer, GLAND_TREE_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
439 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
440
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
441 case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator OR Heightmap rotation
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
442 /* case GLAND_HEIGHTMAP_ROTATION_TEXT: case GLAND_HEIGHTMAP_ROTATION_PULLDOWN:*/
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
443 if (mode == GLWP_HEIGHTMAP) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
444 ShowDropDownMenu(w, rotation, _patches_newgame.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
445 } else {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
446 ShowDropDownMenu(w, landscape, _patches_newgame.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
447 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
448 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
449
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
450 case GLAND_TERRAIN_PULLDOWN: // Terrain type
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
451 ShowDropDownMenu(w, elevations, _opt_newgame.diff.terrain_type, GLAND_TERRAIN_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
452 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
453
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
454 case GLAND_WATER_PULLDOWN: // Water quantity
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
455 ShowDropDownMenu(w, sea_lakes, _opt_newgame.diff.quantity_sea_lakes, GLAND_WATER_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
456 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
457
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
458 case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
459 ShowDropDownMenu(w, smoothness, _patches_newgame.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
460 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
461 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
462 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
463
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
464 case WE_MOUSELOOP:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
465 HandleEditBox(w, &_genseed_query, GLAND_RANDOM_EDITBOX);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
466 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
467
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
468 case WE_KEYPRESS:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
469 HandleEditBoxKey(w, &_genseed_query, GLAND_RANDOM_EDITBOX, e);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
470 /* the seed is unsigned, therefore atoi cannot be used.
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
471 * As 2^32 - 1 (MAX_UVALUE(uint32)) is a 'magic' value
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
472 * (use random seed) it should not be possible to be
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
473 * entered into the input field; the generate seed
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
474 * button can be used instead. */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
475 _patches_newgame.generation_seed = minu(strtoul(_genseed_buffer, NULL, sizeof(_genseed_buffer) - 1), MAX_UVALUE(uint32) - 1);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
476 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
477
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
478 case WE_DROPDOWN_SELECT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
479 switch (e->we.dropdown.button) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
480 case GLAND_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = e->we.dropdown.index; break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
481 case GLAND_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index; break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
482 case GLAND_TREE_PULLDOWN: _patches_newgame.tree_placer = e->we.dropdown.index; break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
483 case GLAND_SMOOTHNESS_PULLDOWN: _patches_newgame.tgen_smoothness = e->we.dropdown.index; break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
484
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
485 case GLAND_TOWN_PULLDOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
486 _opt_newgame.diff.number_towns = e->we.dropdown.index;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
487 if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
488 DoCommandP(0, 2, _opt_newgame.diff.number_towns, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
489 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
490
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
491 case GLAND_INDUSTRY_PULLDOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
492 _opt_newgame.diff.number_industries = e->we.dropdown.index;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
493 if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
494 DoCommandP(0, 3, _opt_newgame.diff.number_industries, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
495 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
496
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
497 case GLAND_LANDSCAPE_PULLDOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
498 /* case GLAND_HEIGHTMAP_PULLDOWN: */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
499 if (mode == GLWP_HEIGHTMAP) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
500 _patches_newgame.heightmap_rotation = e->we.dropdown.index;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
501 } else {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
502 _patches_newgame.land_generator = e->we.dropdown.index;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
503 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
504 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
505
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
506 case GLAND_TERRAIN_PULLDOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
507 _opt_newgame.diff.terrain_type = e->we.dropdown.index;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
508 if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
509 DoCommandP(0, 12, _opt_newgame.diff.terrain_type, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
510 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
511
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
512 case GLAND_WATER_PULLDOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
513 _opt_newgame.diff.quantity_sea_lakes = e->we.dropdown.index;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
514 if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
515 DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
516 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
517 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
518 SetWindowDirty(w);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
519 break;
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
520
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
521 case WE_ON_EDIT_TEXT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
522 if (e->we.edittext.str != NULL) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
523 int32 value = atoi(e->we.edittext.str);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
524
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
525 switch (WP(w, generate_d).widget_id) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
526 case GLAND_START_DATE_TEXT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
527 w->InvalidateWidget(GLAND_START_DATE_TEXT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
528 _patches_newgame.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
529 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
530
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
531 case GLAND_SNOW_LEVEL_TEXT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
532 w->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
533 _patches_newgame.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
534 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
535 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
536
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
537 SetWindowDirty(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
538 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
539 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
540 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
541 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
542
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
543 static const WindowDesc _generate_landscape_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7313
diff changeset
544 WDP_CENTER, WDP_CENTER, 338, 268, 338, 268,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
545 WC_GENERATE_LANDSCAPE, WC_NONE,
8019
9e262ce81acf (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas <belugas@openttd.org>
parents: 8018
diff changeset
546 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
547 _generate_landscape_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
548 GenerateLandscapeWndProc,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
549 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
550
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
551 static const WindowDesc _heightmap_load_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7313
diff changeset
552 WDP_CENTER, WDP_CENTER, 338, 236, 338, 236,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
553 WC_GENERATE_LANDSCAPE, WC_NONE,
8019
9e262ce81acf (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas <belugas@openttd.org>
parents: 8018
diff changeset
554 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
555 _heightmap_load_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
556 GenerateLandscapeWndProc,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
557 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
558
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
559 static void _ShowGenerateLandscape(glwp_modes mode)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
560 {
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
561 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
562 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
563
5901
6715d3646509 (svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater <Darkvater@openttd.org>
parents: 5899
diff changeset
564 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
565
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
566 /* Always give a new seed if not editor */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
567 if (_game_mode != GM_EDITOR) _patches_newgame.generation_seed = InteractiveRandom();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
568
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
569 if (mode == GLWP_HEIGHTMAP) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
570 /* 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
571 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
572 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
573
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
574 Window *w = AllocateWindowDescFront((mode == GLWP_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc, 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
575
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
576 if (w == NULL) return;
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
577
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
578 if (mode == GLWP_HEIGHTMAP) {
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
579 WP(w, generate_d).x = x;
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
580 WP(w, generate_d).y = y;
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
581 strecpy(WP(w, generate_d).name, _file_to_saveload.title, lastof(WP(w, generate_d).name));
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
582 }
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
583
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
584 InvalidateWindow(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
585 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
586
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
587 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
588 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
589 _ShowGenerateLandscape(GLWP_GENERATE);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
590 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
591
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
592 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
593 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
594 _ShowGenerateLandscape(GLWP_HEIGHTMAP);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
595 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
596
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
597 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
598 {
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
599 if (_patches_newgame.town_layout == TL_NO_ROADS) {
6777295c2328 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas <belugas@openttd.org>
parents: 6560
diff changeset
600 _patches_newgame.town_layout = TL_ORIGINAL;
6777295c2328 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas <belugas@openttd.org>
parents: 6560
diff changeset
601 }
6777295c2328 (svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas <belugas@openttd.org>
parents: 6560
diff changeset
602
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
603 StartGeneratingLandscape(GLWP_SCENARIO);
71bc001a6dde (svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater <Darkvater@openttd.org>
parents: 5894
diff changeset
604 }
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
605
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
606 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
607 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
608 /* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
609 _patches_newgame.generation_seed = seed;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
610
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
611 StartGeneratingLandscape(GLWP_GENERATE);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
612 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
613
5892
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
614 enum CreateScenarioWindowWidgets {
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
615 CSCEN_TEMPERATE = 3,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
616 CSCEN_ARCTIC,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
617 CSCEN_TROPICAL,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
618 CSCEN_TOYLAND,
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
619 CSCEN_EMPTY_WORLD,
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
620 CSCEN_RANDOM_WORLD,
5892
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
621 CSCEN_MAPSIZE_X_TEXT,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
622 CSCEN_MAPSIZE_X_PULLDOWN,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
623 CSCEN_MAPSIZE_Y_TEXT,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
624 CSCEN_MAPSIZE_Y_PULLDOWN,
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
625 CSCEN_START_DATE_LABEL,
5892
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
626 CSCEN_START_DATE_DOWN,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
627 CSCEN_START_DATE_TEXT,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
628 CSCEN_START_DATE_UP,
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
629 CSCEN_FLAT_LAND_HEIGHT_LABEL,
5892
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
630 CSCEN_FLAT_LAND_HEIGHT_DOWN,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
631 CSCEN_FLAT_LAND_HEIGHT_TEXT,
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
632 CSCEN_FLAT_LAND_HEIGHT_UP
64960d9ae9f3 (svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater <Darkvater@openttd.org>
parents: 5668
diff changeset
633 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
634
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
635
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
636 static void CreateScenarioWndProc(Window *w, WindowEvent *e)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
637 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
638 switch (e->event) {
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
639 case WE_CREATE:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
640 w->LowerWidget(_opt_newgame.landscape + CSCEN_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
641 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
642
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
643 case WE_PAINT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
644 w->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
645 w->SetWidgetDisabledState(CSCEN_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
646 w->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
647 w->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= MAX_TILE_HEIGHT);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
648
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
649 w->SetWidgetLoweredState(CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
650 w->SetWidgetLoweredState(CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
651 w->SetWidgetLoweredState(CSCEN_TROPICAL, _opt_newgame.landscape == LT_TROPIC);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
652 w->SetWidgetLoweredState(CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
653
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
654 /* Set parameters for widget text that requires them */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
655 SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); // CSCEN_START_DATE_TEXT
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
656 SetDParam(1, 1 << _patches_newgame.map_x); // CSCEN_MAPSIZE_X_PULLDOWN
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
657 SetDParam(2, 1 << _patches_newgame.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
658 SetDParam(3, _patches_newgame.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
659
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
660 DrawWindowWidgets(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
661
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
662 break;
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
663
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
664 case WE_CLICK:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
665 switch (e->we.click.widget) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
666 case CSCEN_TEMPERATE:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
667 case CSCEN_ARCTIC:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
668 case CSCEN_TROPICAL:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
669 case CSCEN_TOYLAND:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
670 w->RaiseWidget(_opt_newgame.landscape + CSCEN_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
671 SetNewLandscapeType(e->we.click.widget - CSCEN_TEMPERATE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
672 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
673
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
674 case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
675 ShowDropDownList(w, BuildMapsizeDropDown(), _patches_newgame.map_x, CSCEN_MAPSIZE_X_PULLDOWN);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
676 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
677
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
678 case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
679 ShowDropDownList(w, BuildMapsizeDropDown(), _patches_newgame.map_y, CSCEN_MAPSIZE_Y_PULLDOWN);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
680 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
681
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
682 case CSCEN_EMPTY_WORLD: // Empty world / flat world
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
683 StartGeneratingLandscape(GLWP_SCENARIO);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
684 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
685
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
686 case CSCEN_RANDOM_WORLD: // Generate
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
687 ShowGenerateLandscape();
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
688 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
689
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
690 case CSCEN_START_DATE_DOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
691 case CSCEN_START_DATE_UP: // Year buttons
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
692 /* Don't allow too fast scrolling */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
693 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
694 w->HandleButtonClick(e->we.click.widget);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
695 SetWindowDirty(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
696
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
697 _patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + e->we.click.widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
698 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
699 _left_button_clicked = false;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
700 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
701
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
702 case CSCEN_START_DATE_TEXT: // Year text
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
703 WP(w, generate_d).widget_id = CSCEN_START_DATE_TEXT;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
704 SetDParam(0, _patches_newgame.starting_year);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
705 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
706 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
707
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
708 case CSCEN_FLAT_LAND_HEIGHT_DOWN:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
709 case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
710 /* Don't allow too fast scrolling */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
711 if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
712 w->HandleButtonClick(e->we.click.widget);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
713 SetWindowDirty(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
714
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
715 _patches_newgame.se_flat_world_height = Clamp(_patches_newgame.se_flat_world_height + e->we.click.widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
716 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
717 _left_button_clicked = false;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
718 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
719
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
720 case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
721 WP(w, generate_d).widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
722 SetDParam(0, _patches_newgame.se_flat_world_height);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
723 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, w, CS_NUMERAL);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
724 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
725 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
726 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
727
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
728 case WE_DROPDOWN_SELECT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
729 switch (e->we.dropdown.button) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
730 case CSCEN_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = e->we.dropdown.index; break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
731 case CSCEN_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index; 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
732 }
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
733 SetWindowDirty(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
734 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
735
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
736 case WE_ON_EDIT_TEXT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
737 if (e->we.edittext.str != NULL) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
738 int32 value = atoi(e->we.edittext.str);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
739
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
740 switch (WP(w, generate_d).widget_id) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
741 case CSCEN_START_DATE_TEXT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
742 w->InvalidateWidget(CSCEN_START_DATE_TEXT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
743 _patches_newgame.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
744 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
745
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
746 case CSCEN_FLAT_LAND_HEIGHT_TEXT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
747 w->InvalidateWidget(CSCEN_FLAT_LAND_HEIGHT_TEXT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
748 _patches_newgame.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
749 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
750 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
751
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
752 SetWindowDirty(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
753 }
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
754 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
755 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
756 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
757
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
758 static const Widget _create_scenario_widgets[] = {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
759 { WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
760 { WWT_CAPTION, RESIZE_NONE, 13, 11, 337, 0, 13, STR_SE_CAPTION, STR_NULL},
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
761 { WWT_PANEL, RESIZE_NONE, 13, 0, 337, 14, 169, 0x0, STR_NULL},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
762
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
763 { WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 24, 78, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
764 { WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 24, 78, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
765 { WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 24, 78, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
766 { WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 24, 78, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
767
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
768 { WWT_TEXTBTN, RESIZE_NONE, 6, 12, 115, 95, 124, STR_SE_FLAT_WORLD, STR_SE_FLAT_WORLD_TIP}, // Empty (sea-level) map
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
769 { WWT_TEXTBTN, RESIZE_NONE, 6, 12, 115, 131, 160, STR_SE_RANDOM_LAND, STR_022A_GENERATE_RANDOM_LAND}, // Generate
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
770
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
771 { WWT_TEXT, RESIZE_NONE, 12, 182, 212, 96, 106, STR_MAPSIZE, STR_NULL},
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
772 { WWT_DROPDOWN, RESIZE_NONE, 12, 216, 263, 95, 106, STR_NUM_1, STR_NULL}, // Mapsize X
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
773 { WWT_TEXT, RESIZE_NONE, 12, 268, 276, 96, 106, STR_BY, STR_NULL},
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
774 { WWT_DROPDOWN, RESIZE_NONE, 12, 279, 326, 95, 106, STR_NUM_2, STR_NULL}, // Mapsize Y
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
775
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
776 { WWT_TEXT, RESIZE_NONE, 0, 182, 212, 114, 124, STR_DATE, STR_NULL},
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
777 { WWT_IMGBTN, RESIZE_NONE, 12, 216, 227, 113, 124, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
778 { WWT_TEXTBTN, RESIZE_NONE, 12, 228, 314, 113, 124, STR_GENERATE_DATE, STR_NULL},
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
779 { WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 113, 124, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
780
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
781 { WWT_TEXT, RESIZE_NONE, 0, 182, 278, 132, 142, STR_FLAT_WORLD_HEIGHT, STR_NULL},
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
782 { WWT_IMGBTN, RESIZE_NONE, 12, 282, 293, 131, 142, SPR_ARROW_DOWN, STR_FLAT_WORLD_HEIGHT_DOWN},
8353
6fb24ab5c935 (svn r11919) -Codechange: Assign numbered parameters to world generator widgets to avoid separate DrawString()s, and do the same for the scenario flat-land window.
peter1138 <peter1138@openttd.org>
parents: 8341
diff changeset
783 { WWT_TEXTBTN, RESIZE_NONE, 12, 294, 314, 131, 142, STR_NUM_3, STR_NULL},
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
784 { WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 131, 142, SPR_ARROW_UP, STR_FLAT_WORLD_HEIGHT_UP},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
785 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
786 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
787
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
788 static const WindowDesc _create_scenario_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7313
diff changeset
789 WDP_CENTER, WDP_CENTER, 338, 170, 338, 170,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
790 WC_GENERATE_LANDSCAPE, WC_NONE,
8019
9e262ce81acf (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas <belugas@openttd.org>
parents: 8018
diff changeset
791 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
792 _create_scenario_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
793 CreateScenarioWndProc,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
794 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
795
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
796 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
797 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
798 DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
799 AllocateWindowDescFront(&_create_scenario_desc, GLWP_SCENARIO);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
800 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
801
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
802
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
803 static const Widget _show_terrain_progress_widgets[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
804 { WWT_CAPTION, RESIZE_NONE, 14, 0, 180, 0, 13, STR_GENERATION_WORLD, STR_018C_WINDOW_TITLE_DRAG_THIS},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
805 { WWT_PANEL, RESIZE_NONE, 14, 0, 180, 14, 96, 0x0, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
806 { WWT_TEXTBTN, RESIZE_NONE, 15, 20, 161, 74, 85, STR_GENERATION_ABORT, STR_NULL}, // Abort button
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
807 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
808 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
809
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
810 struct tp_info {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
811 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
812 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
813 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
814 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
815 int timer;
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 6247
diff changeset
816 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
817
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
818 static tp_info _tp;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
819
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
820 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
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 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
823 AbortGeneratingWorld();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
824 } else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) {
5668
3d6d9bff3dd8 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138 <peter1138@openttd.org>
parents: 5587
diff changeset
825 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
826 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
827 }
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 static void ShowTerrainProgressProc(Window* w, WindowEvent* e)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
830 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
831 switch (e->event) {
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
832 case WE_CLICK:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
833 switch (e->we.click.widget) {
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
834 case 2:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
835 if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
836 ShowQuery(
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
837 STR_GENERATION_ABORT_CAPTION,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
838 STR_GENERATION_ABORT_MESSAGE,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
839 w,
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
840 AbortGeneratingWorldCallback
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
841 );
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
842 break;
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
843 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
844 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
845
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
846 case WE_PAINT:
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
847 DrawWindowWidgets(w);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
848
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
849 /* Draw the % complete with a bar and a text */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
850 DrawFrameRect(19, 20, (w->width - 18), 37, 14, FR_BORDERONLY);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
851 DrawFrameRect(20, 21, (int)((w->width - 40) * _tp.percent / 100) + 20, 36, 10, FR_NONE);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
852 SetDParam(0, _tp.percent);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
853 DrawStringCentered(90, 25, STR_PROGRESS, TC_FROMSTRING);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
854
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
855 /* Tell which class we are generating */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
856 DrawStringCentered(90, 46, _tp.cls, TC_FROMSTRING);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
857
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
858 /* And say where we are in that class */
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
859 SetDParam(0, _tp.current);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
860 SetDParam(1, _tp.total);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
861 DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
862
8355
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
863 SetWindowDirty(w);
73ad124db503 (svn r11921) -Cleanup: correct indenting and switch case line spacing.
peter1138 <peter1138@openttd.org>
parents: 8353
diff changeset
864 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
865 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
866 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
867
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
868 static const WindowDesc _show_terrain_progress_desc = {
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7313
diff changeset
869 WDP_CENTER, WDP_CENTER, 181, 97, 181, 97,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5892
diff changeset
870 WC_GENERATE_PROGRESS_WINDOW, WC_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
871 WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
872 _show_terrain_progress_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
873 ShowTerrainProgressProc
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
874 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
875
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
876 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
877 * 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
878 */
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
879 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
880 {
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
881 _tp.cls = STR_WORLD_GENERATION;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
882 _tp.current = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
883 _tp.total = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
884 _tp.percent = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
885 _tp.timer = 0; // Forces to paint the progress window immediatelly
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
886 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
887
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
888 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
889 * 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
890 */
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 6179
diff changeset
891 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
892 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
893 AllocateWindowDescFront(&_show_terrain_progress_desc, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
894 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
895
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
896 static void _SetGeneratingWorldProgress(gwp_class cls, uint progress, uint total)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
897 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
898 static const int percent_table[GWP_CLASS_COUNT + 1] = {0, 5, 15, 20, 40, 60, 65, 80, 85, 99, 100 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
899 static const StringID class_table[GWP_CLASS_COUNT] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
900 STR_WORLD_GENERATION,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
901 STR_022E_LANDSCAPE_GENERATION,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
902 STR_CLEARING_TILES,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
903 STR_022F_TOWN_GENERATION,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
904 STR_0230_INDUSTRY_GENERATION,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
905 STR_UNMOVABLE_GENERATION,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
906 STR_TREE_GENERATION,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
907 STR_SETTINGUP_GAME,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
908 STR_PREPARING_TILELOOP,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
909 STR_PREPARING_GAME
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
910 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
911
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
912 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
913
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
914 /* 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
915 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
916
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
917 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
918
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
919 if (total == 0) {
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
920 assert(_tp.cls == class_table[cls]);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
921 _tp.current += progress;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
922 } else {
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
923 _tp.cls = class_table[cls];
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
924 _tp.current = progress;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
925 _tp.total = total;
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
926 _tp.percent = percent_table[cls];
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
927 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
928
7018
a05bbdc788a2 (svn r10276) -Codechange: made a counter based on milliseconds and independent of the game-state to base double-click and TGP Generation Process on
truelight <truelight@openttd.org>
parents: 6571
diff changeset
929 /* Don't update the screen too often. So update it once in every 200ms */
a05bbdc788a2 (svn r10276) -Codechange: made a counter based on milliseconds and independent of the game-state to base double-click and TGP Generation Process on
truelight <truelight@openttd.org>
parents: 6571
diff changeset
930 if (!_network_dedicated && _tp.timer != 0 && _realtime_tick - _tp.timer < 200) 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
931
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
932 /* Percentage is about the number of completed tasks, so 'current - 1' */
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
933 _tp.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_tp.current == 0 ? 0 : _tp.current - 1) / _tp.total;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
934
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
935 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
936 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
937
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
938 /* Never display 0% */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
939 if (_tp.percent == 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
940 /* Reset if percent is lower then the last recorded */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
941 if (_tp.percent < last_percent) 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
942 /* Display every 5%, but 6% is also very valid.. just not smaller steps then 5% */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
943 if (_tp.percent % 5 != 0 && _tp.percent <= last_percent + 5) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
944 /* Never show steps smaller then 2%, even if it is a mod 5% */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
945 if (_tp.percent <= last_percent + 2) return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
946
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
947 DEBUG(net, 1, "Map generation percentage complete: %d", _tp.percent);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
948 last_percent = _tp.percent;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
949
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
950 /* 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
951 return;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
952 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
953
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
954 InvalidateWindow(WC_GENERATE_PROGRESS_WINDOW, 0);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
955 MarkWholeScreenDirty();
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
956 SetGeneratingWorldPaintStatus(true);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
957
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
958 /* We wait here till the paint is done, so we don't read and write
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
959 * on the same tile at the same moment. Nasty hack, but that happens
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
960 * if you implement threading afterwards */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
961 while (IsGeneratingWorldReadyForPaint()) { CSleep(10); }
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
962
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
963 _tp.timer = _realtime_tick;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
964 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
965
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
966 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
967 * 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
968 * @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
969 * @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
970 *
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
971 * 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
972 * 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
973 */
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
974 void SetGeneratingWorldProgress(gwp_class cls, uint total)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
975 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
976 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
977
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
978 _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
979 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
980
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
981 /**
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
982 * 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
983 * @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
984 *
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
985 * 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
986 * 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
987 */
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
988 void IncreaseGeneratingWorldProgress(gwp_class cls)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
989 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
990 /* 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
991 _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
992 }