author | celestar |
Wed, 13 Jun 2007 11:45:14 +0000 | |
branch | gamebalance |
changeset 9911 | 0b8b245a2391 |
parent 9909 | dce9a6923bb7 |
permissions | -rw-r--r-- |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
1 |
/* $Id$ */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
2 |
|
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6152
diff
changeset
|
3 |
/** @file genworld_gui.cpp */ |
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6152
diff
changeset
|
4 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
6 |
#include "openttd.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
7 |
#include "heightmap.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
8 |
#include "functions.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
9 |
#include "table/strings.h" |
4366
b40a2ecadf99
(svn r6082) -CodeChange : Remove the unneeded table/sprites.h include in newgrf_cargo.h.
belugas
parents:
4364
diff
changeset
|
10 |
#include "table/sprites.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
11 |
#include "window.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
12 |
#include "gui.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
13 |
#include "gfx.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
14 |
#include "strings.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
15 |
#include "gfxinit.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
16 |
#include "player.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
17 |
#include "command.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
18 |
#include "sound.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
19 |
#include "variables.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
20 |
#include "string.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
21 |
#include "settings.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
22 |
#include "debug.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
23 |
#include "genworld.h" |
5720
cc0ceeafaa55
(svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents:
5715
diff
changeset
|
24 |
#include "network/network.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
25 |
#include "thread.h" |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
26 |
#include "date.h" |
5228
c4a780348f66
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5213
diff
changeset
|
27 |
#include "newgrf_config.h" |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
28 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
29 |
/** |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
30 |
* In what 'mode' the GenerateLandscapeWindowProc is. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
31 |
*/ |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
32 |
enum glwp_modes { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
33 |
GLWP_GENERATE, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
34 |
GLWP_HEIGHTMAP, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
35 |
GLWP_SCENARIO, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
36 |
GLWP_END |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
37 |
}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
38 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
39 |
static uint _heightmap_x = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
40 |
static uint _heightmap_y = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
41 |
static StringID _heightmap_str = STR_NULL; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
42 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
43 |
extern void SwitchMode(int new_mode); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
44 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
45 |
static inline void SetNewLandscapeType(byte landscape) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
46 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
47 |
_opt_newgame.landscape = landscape; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
48 |
InvalidateWindowClasses(WC_SELECT_GAME); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
49 |
InvalidateWindowClasses(WC_GENERATE_LANDSCAPE); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
50 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
51 |
|
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
52 |
enum GenerateLandscapeWindowWidgets { |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
53 |
GLAND_TEMPERATE = 3, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
54 |
GLAND_ARCTIC, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
55 |
GLAND_TROPICAL, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
56 |
GLAND_TOYLAND, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
57 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
58 |
GLAND_MAPSIZE_X_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
59 |
GLAND_MAPSIZE_X_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
60 |
GLAND_MAPSIZE_Y_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
61 |
GLAND_MAPSIZE_Y_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
62 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
63 |
GLAND_TOWN_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
64 |
GLAND_TOWN_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
65 |
GLAND_INDUSTRY_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
66 |
GLAND_INDUSTRY_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
67 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
68 |
GLAND_RANDOM_EDITBOX, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
69 |
GLAND_RANDOM_BUTTON, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
70 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
71 |
GLAND_GENERATE_BUTTON, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
72 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
73 |
GLAND_START_DATE_DOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
74 |
GLAND_START_DATE_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
75 |
GLAND_START_DATE_UP, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
76 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
77 |
GLAND_SNOW_LEVEL_DOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
78 |
GLAND_SNOW_LEVEL_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
79 |
GLAND_SNOW_LEVEL_UP, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
80 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
81 |
GLAND_TREE_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
82 |
GLAND_TREE_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
83 |
GLAND_LANDSCAPE_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
84 |
GLAND_LANDSCAPE_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
85 |
GLAND_HEIGHTMAP_ROTATION_TEXT = GLAND_LANDSCAPE_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
86 |
GLAND_HEIGHTMAP_ROTATION_PULLDOWN = GLAND_LANDSCAPE_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
87 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
88 |
GLAND_TERRAIN_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
89 |
GLAND_TERRAIN_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
90 |
GLAND_WATER_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
91 |
GLAND_WATER_PULLDOWN, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
92 |
GLAND_SMOOTHNESS_TEXT, |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
93 |
GLAND_SMOOTHNESS_PULLDOWN |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
94 |
}; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
95 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
96 |
static const Widget _generate_landscape_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
97 |
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
98 |
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 337, 0, 13, STR_WORLD_GENERATION_CAPTION, STR_NULL}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
99 |
{ WWT_PANEL, RESIZE_NONE, 13, 0, 337, 14, 267, 0x0, STR_NULL}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
100 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
101 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 24, 78, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
102 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 24, 78, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
103 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 24, 78, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
104 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 24, 78, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
105 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
106 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 149, 90, 101, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
107 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 150, 161, 90, 101, STR_0225, STR_NULL}, // Mapsize X |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
108 |
{ WWT_PANEL, RESIZE_NONE, 12, 180, 215, 90, 101, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
109 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 216, 227, 90, 101, STR_0225, STR_NULL}, // Mapsize Y |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
110 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
111 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 163, 112, 123, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
112 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 164, 175, 112, 123, STR_0225, STR_NULL}, // Number of towns |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
113 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 163, 130, 141, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
114 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 164, 175, 130, 141, STR_0225, STR_NULL}, // Number of industries |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
115 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
116 |
{ WWT_PANEL, RESIZE_NONE, 15, 114, 207, 152, 163, 0x0, STR_RANDOM_SEED_HELP}, // Edit box for seed |
4364
0fc1e43842f6
(svn r6079) -Change: size and alignment of random seed input box and randomise button
glx
parents:
4344
diff
changeset
|
117 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 216, 326, 152, 163, STR_RANDOM, STR_RANDOM_HELP}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
118 |
|
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
119 |
{ WWT_TEXTBTN, RESIZE_NONE, 6, 243, 326, 228, 257, STR_GENERATE, STR_NULL}, // Generate button |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
120 |
|
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
121 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 216, 227, 112, 123, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
122 |
{ WWT_PANEL, RESIZE_NONE, 12, 228, 314, 112, 123, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
123 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 112, 123, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
124 |
|
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
125 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 282, 293, 130, 141, SPR_ARROW_DOWN, STR_SNOW_LINE_DOWN}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
126 |
{ WWT_PANEL, RESIZE_NONE, 12, 294, 314, 130, 141, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
127 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 130, 141, SPR_ARROW_UP, STR_SNOW_LINE_UP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
128 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
129 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 219, 192, 203, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
130 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 192, 203, STR_0225, STR_NULL}, // Tree placer |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
131 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 219, 174, 185, 0x0, STR_NULL}, |
4750
763ede308217
(svn r6663) -Codechange: Remove the 32 widgets limit on landscape generator.
belugas
parents:
4729
diff
changeset
|
132 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 174, 185, STR_0225, STR_NULL}, // Landscape generator |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
133 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 219, 210, 221, 0x0, STR_NULL}, |
4750
763ede308217
(svn r6663) -Codechange: Remove the 32 widgets limit on landscape generator.
belugas
parents:
4729
diff
changeset
|
134 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 210, 221, STR_0225, STR_NULL}, // Terrain type |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
135 |
{ WWT_PANEL, RESIZE_NONE, 12, 113, 219, 228, 239, 0x0, STR_NULL}, |
4750
763ede308217
(svn r6663) -Codechange: Remove the 32 widgets limit on landscape generator.
belugas
parents:
4729
diff
changeset
|
136 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 228, 239, STR_0225, STR_NULL}, // Water quantity |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
137 |
{ WWT_PANEL, RESIZE_NONE, 12, 113, 219, 246, 257, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
138 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 246, 257, STR_0225, STR_NULL}, // Map smoothness |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
139 |
{ WIDGETS_END}, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
140 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
141 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
142 |
static const Widget _heightmap_load_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
143 |
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
144 |
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 337, 0, 13, STR_WORLD_GENERATION_CAPTION, STR_NULL}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
145 |
{ WWT_PANEL, RESIZE_NONE, 13, 0, 337, 14, 235, 0x0, STR_NULL}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
146 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
147 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 24, 78, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
148 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 24, 78, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
149 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 24, 78, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
150 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 24, 78, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
151 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
152 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 149, 112, 123, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
153 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 150, 161, 112, 123, STR_0225, STR_NULL}, // Mapsize X |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
154 |
{ WWT_PANEL, RESIZE_NONE, 12, 180, 215, 112, 123, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
155 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 216, 227, 112, 123, STR_0225, STR_NULL}, // Mapsize Y |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
156 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
157 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 163, 134, 145, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
158 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 164, 175, 134, 145, STR_0225, STR_NULL}, // Number of towns |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
159 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 163, 152, 163, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
160 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 164, 175, 152, 163, STR_0225, STR_NULL}, // Number of industries |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
161 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
162 |
{ WWT_PANEL, RESIZE_NONE, 15, 114, 194, 174, 185, 0x0, STR_RANDOM_SEED_HELP}, // Edit box for seed |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
163 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 203, 285, 174, 185, STR_RANDOM, STR_RANDOM_HELP}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
164 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
165 |
{ WWT_TEXTBTN, RESIZE_NONE, 6, 243, 326, 196, 225, STR_GENERATE, STR_NULL}, // Generate button |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
166 |
|
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
167 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 216, 227, 134, 145, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
168 |
{ WWT_PANEL, RESIZE_NONE, 12, 228, 314, 134, 145, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
169 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 134, 145, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
170 |
|
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
171 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 282, 293, 152, 163, SPR_ARROW_DOWN, STR_SNOW_LINE_DOWN}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
172 |
{ WWT_PANEL, RESIZE_NONE, 12, 294, 314, 152, 163, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
173 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 152, 163, SPR_ARROW_UP, STR_SNOW_LINE_UP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
174 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
175 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 219, 196, 207, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
176 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 196, 207, STR_0225, STR_NULL}, // Tree placer |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
177 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
178 |
{ WWT_PANEL, RESIZE_NONE, 12, 114, 219, 214, 225, 0x0, STR_NULL}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
179 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 220, 231, 214, 225, STR_0225, STR_NULL}, // Heightmap rotation |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
180 |
{ WIDGETS_END}, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
181 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
182 |
|
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
183 |
void StartGeneratingLandscape(glwp_modes mode) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
184 |
{ |
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
185 |
DeleteAllNonVitalWindows(); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
186 |
|
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
187 |
/* Copy all XXX_newgame to XXX when coming from outside the editor */ |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
188 |
UpdatePatches(); |
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
189 |
_opt = _opt_newgame; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
190 |
_opt_ptr = &_opt; |
5228
c4a780348f66
(svn r7348) -Feature: Initial support for saving NewGRF settings with savegames. Back up your savegames...
peter1138
parents:
5213
diff
changeset
|
191 |
ResetGRFConfig(true); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
192 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
193 |
SndPlayFx(SND_15_BEEP); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
194 |
switch (mode) { |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
195 |
case GLWP_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break; |
d34703513ed0
(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
parents:
6144
diff
changeset
|
196 |
case GLWP_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break; |
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
197 |
case GLWP_SCENARIO: _switch_mode = SM_EDITOR; break; |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
198 |
default: NOT_REACHED(); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
199 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
200 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
201 |
|
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
202 |
static void LandscapeGenerationCallback(Window *w, bool confirmed) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
203 |
{ |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
204 |
if (confirmed) StartGeneratingLandscape((glwp_modes)w->window_number); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
205 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
206 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
207 |
static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
208 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
209 |
static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
210 |
static const StringID elevations[] = {STR_682A_VERY_FLAT, STR_682B_FLAT, STR_682C_HILLY, STR_682D_MOUNTAINOUS, INVALID_STRING_ID}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
211 |
static const StringID sea_lakes[] = {STR_VERY_LOW, STR_6820_LOW, STR_6821_MEDIUM, STR_6822_HIGH, INVALID_STRING_ID}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
212 |
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}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
213 |
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}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
214 |
static const StringID rotation[] = {STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_CLOCKWISE, INVALID_STRING_ID}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
215 |
static const StringID landscape[] = {STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL, STR_CONFIG_PATCHES_LAND_GENERATOR_TERRA_GENESIS, INVALID_STRING_ID}; |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
216 |
static const StringID num_towns[] = {STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID}; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
217 |
static const StringID num_inds[] = {STR_26816_NONE, STR_NUM_VERY_LOW, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
218 |
|
5715
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
219 |
/* Data used for the generate seed edit box */ |
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
220 |
static querystr_d _genseed_query; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
221 |
static char _genseed_buffer[11]; |
5715
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
222 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
223 |
glwp_modes mode = (glwp_modes)w->window_number; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
224 |
uint y; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
225 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
226 |
switch (e->event) { |
5715
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
227 |
case WE_CREATE: |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
228 |
LowerWindowWidget(w, _opt_newgame.landscape + GLAND_TEMPERATE); |
5715
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
229 |
|
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
230 |
snprintf(_genseed_buffer, sizeof(_genseed_buffer), "%u", _patches_newgame.generation_seed); |
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
231 |
InitializeTextBuffer(&_genseed_query.text, _genseed_buffer, lengthof(_genseed_buffer), 120); |
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
232 |
_genseed_query.caption = STR_NULL; |
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
233 |
_genseed_query.afilter = CS_NUMERAL; |
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
234 |
break; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
235 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
236 |
case WE_PAINT: |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
237 |
/* You can't select smoothness if not terragenesis */ |
5213
f493c647f079
(svn r7328) -Fix: memory corruption. The 'Load Heightmap' window does not have TerraGenesis configuration buttons and it does have only 29 widgets, not at least 33. Thanks to Tefad for finding this bug.
rubidium
parents:
5052
diff
changeset
|
238 |
if (mode == GLWP_GENERATE) { |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
239 |
SetWindowWidgetDisabledState(w, GLAND_SMOOTHNESS_TEXT, _patches_newgame.land_generator == 0); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
240 |
SetWindowWidgetDisabledState(w, GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0); |
5213
f493c647f079
(svn r7328) -Fix: memory corruption. The 'Load Heightmap' window does not have TerraGenesis configuration buttons and it does have only 29 widgets, not at least 33. Thanks to Tefad for finding this bug.
rubidium
parents:
5052
diff
changeset
|
241 |
} |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
242 |
/* Disable snowline if not hilly */ |
9906
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
243 |
SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC); |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
244 |
/* Disable town, industry and trees in SE */ |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
245 |
SetWindowWidgetDisabledState(w, GLAND_TOWN_TEXT, _game_mode == GM_EDITOR); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
246 |
SetWindowWidgetDisabledState(w, GLAND_TOWN_PULLDOWN, _game_mode == GM_EDITOR); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
247 |
SetWindowWidgetDisabledState(w, GLAND_INDUSTRY_TEXT, _game_mode == GM_EDITOR); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
248 |
SetWindowWidgetDisabledState(w, GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
249 |
SetWindowWidgetDisabledState(w, GLAND_TREE_TEXT, _game_mode == GM_EDITOR); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
250 |
SetWindowWidgetDisabledState(w, GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
251 |
|
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
252 |
SetWindowWidgetDisabledState(w, GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
253 |
SetWindowWidgetDisabledState(w, GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); |
9906
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
254 |
SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
255 |
SetWindowWidgetDisabledState(w, GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= 13 || _opt_newgame.landscape != LT_ARCTIC); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
256 |
|
9906
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
257 |
SetWindowWidgetLoweredState(w, GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
258 |
SetWindowWidgetLoweredState(w, GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
259 |
SetWindowWidgetLoweredState(w, GLAND_TROPICAL, _opt_newgame.landscape == LT_TROPIC); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
260 |
SetWindowWidgetLoweredState(w, GLAND_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
261 |
DrawWindowWidgets(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
262 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
263 |
y = (mode == GLWP_HEIGHTMAP) ? 22 : 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
264 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
265 |
DrawString( 12, 91 + y, STR_MAPSIZE, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
266 |
DrawString(119, 91 + y, mapsizes[_patches_newgame.map_x - 6], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
267 |
DrawString(168, 91 + y, STR_BY, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
268 |
DrawString(182, 91 + y, mapsizes[_patches_newgame.map_y - 6], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
269 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
270 |
DrawString( 12, 113 + y, STR_NUMBER_OF_TOWNS, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
271 |
DrawString( 12, 131 + y, STR_NUMBER_OF_INDUSTRIES, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
272 |
if (_game_mode == GM_EDITOR) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
273 |
DrawString(118, 113 + y, STR_6836_OFF, 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
274 |
DrawString(118, 131 + y, STR_6836_OFF, 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
275 |
} else { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
276 |
DrawString(118, 113 + y, num_towns[_opt_newgame.diff.number_towns], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
277 |
DrawString(118, 131 + y, num_inds[_opt_newgame.diff.number_industries], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
278 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
279 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
280 |
DrawString( 12, 153 + y, STR_RANDOM_SEED, 0); |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
281 |
DrawEditBox(w, &_genseed_query, GLAND_RANDOM_EDITBOX); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
282 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
283 |
DrawString(182, 113 + y, STR_DATE, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
284 |
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
285 |
DrawStringCentered(271, 113 + y, STR_GENERATE_DATE, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
286 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
287 |
DrawString(182, 131 + y, STR_SNOW_LINE_HEIGHT, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
288 |
SetDParam(0, _patches_newgame.snow_line_height); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
289 |
DrawStringCentered(303, 131 + y, STR_SNOW_LINE_HEIGHT_NUM, 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
290 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
291 |
if (mode == GLWP_GENERATE) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
292 |
DrawString( 12, 175, STR_LAND_GENERATOR, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
293 |
DrawString(118, 175, landscape[_patches_newgame.land_generator], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
294 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
295 |
DrawString( 12, 193, STR_TREE_PLACER, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
296 |
DrawString(118, 193, tree_placer[_patches_newgame.tree_placer], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
297 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
298 |
DrawString( 12, 211, STR_TERRAIN_TYPE, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
299 |
DrawString(118, 211, elevations[_opt_newgame.diff.terrain_type], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
300 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
301 |
DrawString( 12, 229, STR_QUANTITY_OF_SEA_LAKES, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
302 |
DrawString(118, 229, sea_lakes[_opt_newgame.diff.quantity_sea_lakes], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
303 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
304 |
DrawString( 12, 247, STR_SMOOTHNESS, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
305 |
DrawString(118, 247, smoothness[_patches_newgame.tgen_smoothness], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
306 |
} else { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
307 |
char buffer[512]; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
308 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
309 |
if (_patches_newgame.heightmap_rotation == HM_CLOCKWISE) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
310 |
SetDParam(0, _heightmap_y); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
311 |
SetDParam(1, _heightmap_x); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
312 |
} else { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
313 |
SetDParam(0, _heightmap_x); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
314 |
SetDParam(1, _heightmap_y); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
315 |
} |
4912
d04b3f2bca70
(svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents:
4909
diff
changeset
|
316 |
GetString(buffer, STR_HEIGHTMAP_SIZE, lastof(buffer)); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
317 |
DrawStringRightAligned(326, 91, STR_HEIGHTMAP_SIZE, 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
318 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
319 |
DrawString( 12, 91, STR_HEIGHTMAP_NAME, 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
320 |
SetDParam(0, _heightmap_str); |
4609
6c337b3fbf4b
(svn r6462) -Codechange: Have GetStringWidth() return width as well as the height bounding
Darkvater
parents:
4453
diff
changeset
|
321 |
DrawStringTruncated(114, 91, STR_ORANGE, 0x10, 326 - 114 - GetStringBoundingBox(buffer).width - 5); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
322 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
323 |
DrawString( 12, 197, STR_TREE_PLACER, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
324 |
DrawString(118, 197, tree_placer[_patches_newgame.tree_placer], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
325 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
326 |
DrawString( 12, 215, STR_HEIGHTMAP_ROTATION, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
327 |
DrawString(118, 215, rotation[_patches_newgame.heightmap_rotation], 0x10); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
328 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
329 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
330 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
331 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
332 |
switch (e->we.click.widget) { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
333 |
case 0: DeleteWindow(w); break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
334 |
case GLAND_TEMPERATE: case GLAND_ARCTIC: case GLAND_TROPICAL: case GLAND_TOYLAND: |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
335 |
RaiseWindowWidget(w, _opt_newgame.landscape + GLAND_TEMPERATE); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
336 |
SetNewLandscapeType(e->we.click.widget - GLAND_TEMPERATE); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
337 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
338 |
case GLAND_MAPSIZE_X_TEXT: case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
339 |
ShowDropDownMenu(w, mapsizes, _patches_newgame.map_x - 6, GLAND_MAPSIZE_X_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
340 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
341 |
case GLAND_MAPSIZE_Y_TEXT: case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
342 |
ShowDropDownMenu(w, mapsizes, _patches_newgame.map_y - 6, GLAND_MAPSIZE_Y_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
343 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
344 |
case GLAND_TOWN_TEXT: case GLAND_TOWN_PULLDOWN: // Number of towns |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
345 |
ShowDropDownMenu(w, num_towns, _opt_newgame.diff.number_towns, GLAND_TOWN_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
346 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
347 |
case GLAND_INDUSTRY_TEXT: case GLAND_INDUSTRY_PULLDOWN: // Number of industries |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
348 |
ShowDropDownMenu(w, num_inds, _opt_newgame.diff.number_industries, GLAND_INDUSTRY_PULLDOWN, 0, 0); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
349 |
break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
350 |
case GLAND_RANDOM_BUTTON: // Random seed |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
351 |
_patches_newgame.generation_seed = InteractiveRandom(); |
5715
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
352 |
snprintf(_genseed_buffer, lengthof(_genseed_buffer), "%u", _patches_newgame.generation_seed); |
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
353 |
UpdateTextBufferSize(&_genseed_query.text); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
354 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
355 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
356 |
case GLAND_GENERATE_BUTTON: // Generate |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
357 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
358 |
UpdatePatches(); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
359 |
|
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
360 |
if (_patches.town_layout == TL_NO_ROADS) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
361 |
ShowQuery( |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
362 |
STR_TOWN_LAYOUT_WARNING_CAPTION, |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
363 |
STR_TOWN_LAYOUT_WARNING_MESSAGE, |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
364 |
w, |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
365 |
LandscapeGenerationCallback); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
366 |
} else if (mode == GLWP_HEIGHTMAP && |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
367 |
(_heightmap_x * 2 < (1U << _patches_newgame.map_x) || |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
368 |
_heightmap_x / 2 > (1U << _patches_newgame.map_x) || |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
369 |
_heightmap_y * 2 < (1U << _patches_newgame.map_y) || |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
370 |
_heightmap_y / 2 > (1U << _patches_newgame.map_y))) { |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
371 |
ShowQuery( |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
372 |
STR_HEIGHTMAP_SCALE_WARNING_CAPTION, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
373 |
STR_HEIGHTMAP_SCALE_WARNING_MESSAGE, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
374 |
w, |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
375 |
LandscapeGenerationCallback); |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
376 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
377 |
} else { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
378 |
StartGeneratingLandscape(mode); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
379 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
380 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
381 |
case GLAND_START_DATE_DOWN: case GLAND_START_DATE_UP: // Year buttons |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
382 |
/* Don't allow too fast scrolling */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
383 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
384 |
HandleButtonClick(w, e->we.click.widget); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
385 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
386 |
|
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
387 |
_patches_newgame.starting_year = clamp(_patches_newgame.starting_year + e->we.click.widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
388 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
389 |
_left_button_clicked = false; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
390 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
391 |
case GLAND_START_DATE_TEXT: // Year text |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
392 |
WP(w, def_d).data_3 = GLAND_START_DATE_TEXT; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
393 |
SetDParam(0, _patches_newgame.starting_year); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
394 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
395 |
break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
396 |
case GLAND_SNOW_LEVEL_DOWN: case GLAND_SNOW_LEVEL_UP: // Snow line buttons |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
397 |
/* Don't allow too fast scrolling */ |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
398 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
399 |
HandleButtonClick(w, e->we.click.widget); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
400 |
SetWindowDirty(w); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
401 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
402 |
_patches_newgame.snow_line_height = clamp(_patches_newgame.snow_line_height + e->we.click.widget - GLAND_SNOW_LEVEL_TEXT, 2, 13); |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
403 |
} |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
404 |
_left_button_clicked = false; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
405 |
break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
406 |
case GLAND_SNOW_LEVEL_TEXT: // Snow line text |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
407 |
WP(w, def_d).data_3 = GLAND_SNOW_LEVEL_TEXT; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
408 |
SetDParam(0, _patches_newgame.snow_line_height); |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5669
diff
changeset
|
409 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, w, CS_NUMERAL); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
410 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
411 |
case GLAND_TREE_TEXT: case GLAND_TREE_PULLDOWN: // Tree placer |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
412 |
ShowDropDownMenu(w, tree_placer, _patches_newgame.tree_placer, GLAND_TREE_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
413 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
414 |
case GLAND_LANDSCAPE_TEXT: case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator OR Heightmap rotation |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6152
diff
changeset
|
415 |
/* case GLAND_HEIGHTMAP_ROTATION_TEXT: case GLAND_HEIGHTMAP_ROTATION_PULLDOWN:*/ |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
416 |
if (mode == GLWP_HEIGHTMAP) { |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
417 |
ShowDropDownMenu(w, rotation, _patches_newgame.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
418 |
} else { |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
419 |
ShowDropDownMenu(w, landscape, _patches_newgame.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
420 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
421 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
422 |
case GLAND_TERRAIN_TEXT: case GLAND_TERRAIN_PULLDOWN: // Terrain type |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
423 |
ShowDropDownMenu(w, elevations, _opt_newgame.diff.terrain_type, GLAND_TERRAIN_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
424 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
425 |
case GLAND_WATER_TEXT: case GLAND_WATER_PULLDOWN: // Water quantity |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
426 |
ShowDropDownMenu(w, sea_lakes, _opt_newgame.diff.quantity_sea_lakes, GLAND_WATER_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
427 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
428 |
case GLAND_SMOOTHNESS_TEXT: case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
429 |
ShowDropDownMenu(w, smoothness, _patches_newgame.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
430 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
431 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
432 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
433 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
434 |
case WE_MOUSELOOP: |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
435 |
HandleEditBox(w, &_genseed_query, GLAND_RANDOM_EDITBOX); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
436 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
437 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
438 |
case WE_KEYPRESS: |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
439 |
HandleEditBoxKey(w, &_genseed_query, GLAND_RANDOM_EDITBOX, e); |
4453
890c107f6fa6
(svn r6236) -Fix (FS#313): TGP generation seed edit box only accepted seeds up to 2^31-1, instead of up to 2^32-2.
rubidium
parents:
4366
diff
changeset
|
440 |
/* the seed is unsigned, therefore atoi cannot be used. |
890c107f6fa6
(svn r6236) -Fix (FS#313): TGP generation seed edit box only accepted seeds up to 2^31-1, instead of up to 2^32-2.
rubidium
parents:
4366
diff
changeset
|
441 |
* As 2^32 - 1 (MAX_UVALUE(uint32)) is a 'magic' value |
890c107f6fa6
(svn r6236) -Fix (FS#313): TGP generation seed edit box only accepted seeds up to 2^31-1, instead of up to 2^32-2.
rubidium
parents:
4366
diff
changeset
|
442 |
* (use random seed) it should not be possible to be |
890c107f6fa6
(svn r6236) -Fix (FS#313): TGP generation seed edit box only accepted seeds up to 2^31-1, instead of up to 2^32-2.
rubidium
parents:
4366
diff
changeset
|
443 |
* entered into the input field; the generate seed |
890c107f6fa6
(svn r6236) -Fix (FS#313): TGP generation seed edit box only accepted seeds up to 2^31-1, instead of up to 2^32-2.
rubidium
parents:
4366
diff
changeset
|
444 |
* button can be used instead. */ |
5715
0dceee0154a5
(svn r7733) -Fix (r5946): do not use WP(w, querystr_d) and WP(w, def_d) for the same window.
rubidium
parents:
5682
diff
changeset
|
445 |
_patches_newgame.generation_seed = minu(strtoul(_genseed_buffer, NULL, sizeof(_genseed_buffer) - 1), MAX_UVALUE(uint32) - 1); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
446 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
447 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
448 |
case WE_DROPDOWN_SELECT: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
449 |
switch (e->we.dropdown.button) { |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
450 |
case GLAND_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = e->we.dropdown.index + 6; break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
451 |
case GLAND_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index + 6; break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
452 |
case GLAND_TREE_PULLDOWN: _patches_newgame.tree_placer = e->we.dropdown.index; break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
453 |
case GLAND_SMOOTHNESS_PULLDOWN: _patches_newgame.tgen_smoothness = e->we.dropdown.index; break; |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
454 |
|
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
455 |
case GLAND_TOWN_PULLDOWN: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
456 |
_opt_newgame.diff.number_towns = e->we.dropdown.index; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
457 |
if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
458 |
DoCommandP(0, 2, _opt_newgame.diff.number_towns, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
459 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
460 |
case GLAND_INDUSTRY_PULLDOWN: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
461 |
_opt_newgame.diff.number_industries = e->we.dropdown.index; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
462 |
if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
463 |
DoCommandP(0, 3, _opt_newgame.diff.number_industries, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
464 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
465 |
case GLAND_LANDSCAPE_PULLDOWN: |
6505
abcb0580d976
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6152
diff
changeset
|
466 |
/* case GLAND_HEIGHTMAP_PULLDOWN: */ |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
467 |
if (mode == GLWP_HEIGHTMAP) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
468 |
_patches_newgame.heightmap_rotation = e->we.dropdown.index; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
469 |
} else { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
470 |
_patches_newgame.land_generator = e->we.dropdown.index; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
471 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
472 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
473 |
case GLAND_TERRAIN_PULLDOWN: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
474 |
_opt_newgame.diff.terrain_type = e->we.dropdown.index; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
475 |
if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
476 |
DoCommandP(0, 12, _opt_newgame.diff.terrain_type, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
477 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
478 |
case GLAND_WATER_PULLDOWN: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
479 |
_opt_newgame.diff.quantity_sea_lakes = e->we.dropdown.index; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
480 |
if (_opt_newgame.diff_level != 3) ShowErrorMessage(INVALID_STRING_ID, STR_DIFFICULTY_TO_CUSTOM, 0, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
481 |
DoCommandP(0, 13, _opt_newgame.diff.quantity_sea_lakes, NULL, CMD_CHANGE_DIFFICULTY_LEVEL); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
482 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
483 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
484 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
485 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
486 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
487 |
case WE_ON_EDIT_TEXT: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
488 |
if (e->we.edittext.str != NULL) { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
489 |
int32 value = atoi(e->we.edittext.str); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
490 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
491 |
switch (WP(w, def_d).data_3) { |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
492 |
case GLAND_START_DATE_TEXT: |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
493 |
InvalidateWidget(w, GLAND_START_DATE_TEXT); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
494 |
_patches_newgame.starting_year = clamp(value, MIN_YEAR, MAX_YEAR); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
495 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
496 |
case GLAND_SNOW_LEVEL_TEXT: |
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
497 |
InvalidateWidget(w, GLAND_SNOW_LEVEL_TEXT); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
498 |
_patches_newgame.snow_line_height = clamp(value, 2, 13); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
499 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
500 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
501 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
502 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
503 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
504 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
505 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
506 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
507 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
508 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
509 |
static const WindowDesc _generate_landscape_desc = { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
510 |
WDP_CENTER, WDP_CENTER, 338, 268, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6143
diff
changeset
|
511 |
WC_GENERATE_LANDSCAPE, WC_NONE, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
512 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
513 |
_generate_landscape_widgets, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
514 |
GenerateLandscapeWndProc, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
515 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
516 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
517 |
static const WindowDesc _heightmap_load_desc = { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
518 |
WDP_CENTER, WDP_CENTER, 338, 236, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6143
diff
changeset
|
519 |
WC_GENERATE_LANDSCAPE, WC_NONE, |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
520 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
521 |
_heightmap_load_widgets, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
522 |
GenerateLandscapeWndProc, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
523 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
524 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
525 |
static void _ShowGenerateLandscape(glwp_modes mode) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
526 |
{ |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
527 |
DeleteWindowByClass(WC_GENERATE_LANDSCAPE); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
528 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
529 |
/* Always give a new seed if not editor */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
530 |
if (_game_mode != GM_EDITOR) _patches_newgame.generation_seed = InteractiveRandom(); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
531 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
532 |
if (mode == GLWP_HEIGHTMAP) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
533 |
if (_heightmap_str != STR_NULL) DeleteName(_heightmap_str); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
534 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
535 |
_heightmap_x = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
536 |
_heightmap_y = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
537 |
_heightmap_str = AllocateName(_file_to_saveload.title, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
538 |
/* If the function returns negative, it means there was a problem loading the heightmap */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
539 |
if (!GetHeightmapDimensions(_file_to_saveload.name, &_heightmap_x, &_heightmap_y)) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
540 |
return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
541 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
542 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
543 |
Window *w = AllocateWindowDescFront((mode == GLWP_HEIGHTMAP) ? &_heightmap_load_desc : &_generate_landscape_desc, mode); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
544 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
545 |
if (w != NULL) InvalidateWindow(WC_GENERATE_LANDSCAPE, mode); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
546 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
547 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
548 |
void ShowGenerateLandscape() |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
549 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
550 |
_ShowGenerateLandscape(GLWP_GENERATE); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
551 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
552 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
553 |
void ShowHeightmapLoad() |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
554 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
555 |
_ShowGenerateLandscape(GLWP_HEIGHTMAP); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
556 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
557 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
558 |
void StartScenarioEditor() |
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
559 |
{ |
9911
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
560 |
if (_patches_newgame.town_layout == TL_NO_ROADS) { |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
561 |
_patches_newgame.town_layout = TL_ORIGINAL; |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
562 |
} |
0b8b245a2391
(svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents:
9909
diff
changeset
|
563 |
|
6150
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
564 |
StartGeneratingLandscape(GLWP_SCENARIO); |
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
565 |
} |
648233476115
(svn r8522) -Regression (r8512): The flat/random window moved the to scenario editor did not use the right settings for generating land
Darkvater
parents:
6145
diff
changeset
|
566 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
567 |
void StartNewGameWithoutGUI(uint seed) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
568 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
569 |
/* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
570 |
_patches_newgame.generation_seed = seed; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
571 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
572 |
StartGeneratingLandscape(GLWP_GENERATE); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
573 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
574 |
|
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
575 |
enum CreateScenarioWindowWidgets { |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
576 |
CSCEN_TEMPERATE = 3, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
577 |
CSCEN_ARCTIC, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
578 |
CSCEN_TROPICAL, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
579 |
CSCEN_TOYLAND, |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
580 |
CSCEN_EMPTY_WORLD, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
581 |
CSCEN_RANDOM_WORLD, |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
582 |
CSCEN_MAPSIZE_X_TEXT, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
583 |
CSCEN_MAPSIZE_X_PULLDOWN, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
584 |
CSCEN_MAPSIZE_Y_TEXT, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
585 |
CSCEN_MAPSIZE_Y_PULLDOWN, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
586 |
CSCEN_START_DATE_DOWN, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
587 |
CSCEN_START_DATE_TEXT, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
588 |
CSCEN_START_DATE_UP, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
589 |
CSCEN_FLAT_LAND_HEIGHT_DOWN, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
590 |
CSCEN_FLAT_LAND_HEIGHT_TEXT, |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
591 |
CSCEN_FLAT_LAND_HEIGHT_UP |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
592 |
}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
593 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
594 |
|
d34703513ed0
(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
parents:
6144
diff
changeset
|
595 |
static void CreateScenarioWndProc(Window *w, WindowEvent *e) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
596 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
597 |
static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
598 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
599 |
switch (e->event) { |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
600 |
case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + CSCEN_TEMPERATE); break; |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
601 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
602 |
case WE_PAINT: |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
603 |
SetWindowWidgetDisabledState(w, CSCEN_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
604 |
SetWindowWidgetDisabledState(w, CSCEN_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
605 |
SetWindowWidgetDisabledState(w, CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0); |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
606 |
SetWindowWidgetDisabledState(w, CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= 15); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
607 |
|
9906
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
608 |
SetWindowWidgetLoweredState(w, CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
609 |
SetWindowWidgetLoweredState(w, CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
610 |
SetWindowWidgetLoweredState(w, CSCEN_TROPICAL, _opt_newgame.landscape == LT_TROPIC); |
6f41b8713b65
(svn r9674) [gamebalance] -Sync: r9322:9420 from trunk
celestar
parents:
9895
diff
changeset
|
611 |
SetWindowWidgetLoweredState(w, CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
612 |
DrawWindowWidgets(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
613 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
614 |
DrawStringRightAligned(211, 97, STR_MAPSIZE, 0); |
d34703513ed0
(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
parents:
6144
diff
changeset
|
615 |
DrawString( 221, 97, mapsizes[_patches_newgame.map_x - 6], 0x10); |
d34703513ed0
(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
parents:
6144
diff
changeset
|
616 |
DrawStringCentered( 272, 97, STR_BY, 0); |
d34703513ed0
(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
parents:
6144
diff
changeset
|
617 |
DrawString( 284, 97, mapsizes[_patches_newgame.map_y - 6], 0x10); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
618 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
619 |
DrawStringRightAligned(211, 115, STR_DATE, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
620 |
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
621 |
DrawStringCentered(271, 115, STR_GENERATE_DATE, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
622 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
623 |
DrawStringRightAligned(278, 133, STR_FLAT_WORLD_HEIGHT, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
624 |
SetDParam(0, _patches_newgame.se_flat_world_height); |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
625 |
DrawStringCentered(303, 133, STR_FLAT_WORLD_HEIGHT_NUM, 0x10); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
626 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
627 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
628 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
629 |
switch (e->we.click.widget) { |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
630 |
case CSCEN_TEMPERATE: case CSCEN_ARCTIC: case CSCEN_TROPICAL: case CSCEN_TOYLAND: |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
631 |
RaiseWindowWidget(w, _opt_newgame.landscape + CSCEN_TEMPERATE); |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
632 |
SetNewLandscapeType(e->we.click.widget - CSCEN_TEMPERATE); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
633 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
634 |
case CSCEN_MAPSIZE_X_TEXT: case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
635 |
ShowDropDownMenu(w, mapsizes, _patches_newgame.map_x - 6, CSCEN_MAPSIZE_X_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
636 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
637 |
case CSCEN_MAPSIZE_Y_TEXT: case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y |
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
638 |
ShowDropDownMenu(w, mapsizes, _patches_newgame.map_y - 6, CSCEN_MAPSIZE_Y_PULLDOWN, 0, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
639 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
640 |
case CSCEN_EMPTY_WORLD: // Empty world / flat world |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
641 |
StartGeneratingLandscape(GLWP_SCENARIO); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
642 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
643 |
case CSCEN_RANDOM_WORLD: // Generate |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
644 |
ShowGenerateLandscape(); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
645 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
646 |
case CSCEN_START_DATE_DOWN: case CSCEN_START_DATE_UP: // Year buttons |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
647 |
/* Don't allow too fast scrolling */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
648 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
649 |
HandleButtonClick(w, e->we.click.widget); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
650 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
651 |
|
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
652 |
_patches_newgame.starting_year = clamp(_patches_newgame.starting_year + e->we.click.widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
653 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
654 |
_left_button_clicked = false; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
655 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
656 |
case CSCEN_START_DATE_TEXT: // Year text |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
657 |
WP(w, def_d).data_3 = CSCEN_START_DATE_TEXT; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
658 |
SetDParam(0, _patches_newgame.starting_year); |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5669
diff
changeset
|
659 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
660 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
661 |
case CSCEN_FLAT_LAND_HEIGHT_DOWN: case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
662 |
/* Don't allow too fast scrolling */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
663 |
if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
664 |
HandleButtonClick(w, e->we.click.widget); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
665 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
666 |
|
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
667 |
_patches_newgame.se_flat_world_height = clamp(_patches_newgame.se_flat_world_height + e->we.click.widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, 15); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
668 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
669 |
_left_button_clicked = false; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
670 |
break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
671 |
case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
672 |
WP(w, def_d).data_3 = CSCEN_FLAT_LAND_HEIGHT_TEXT; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
673 |
SetDParam(0, _patches_newgame.se_flat_world_height); |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5669
diff
changeset
|
674 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, w, CS_NUMERAL); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
675 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
676 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
677 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
678 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
679 |
case WE_DROPDOWN_SELECT: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
680 |
switch (e->we.dropdown.button) { |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
681 |
case CSCEN_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = e->we.dropdown.index + 6; break; |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
682 |
case CSCEN_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = e->we.dropdown.index + 6; break; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
683 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
684 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
685 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
686 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
687 |
case WE_ON_EDIT_TEXT: { |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
688 |
if (e->we.edittext.str != NULL) { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
689 |
int32 value = atoi(e->we.edittext.str); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
690 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
691 |
switch (WP(w, def_d).data_3) { |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
692 |
case CSCEN_START_DATE_TEXT: |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
693 |
InvalidateWidget(w, CSCEN_START_DATE_TEXT); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
694 |
_patches_newgame.starting_year = clamp(value, MIN_YEAR, MAX_YEAR); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
695 |
break; |
6152
42ce779b1765
(svn r8524) -Cleanup: Ala r8509 add some enum names to the generate landscape window
Darkvater
parents:
6150
diff
changeset
|
696 |
case CSCEN_FLAT_LAND_HEIGHT_TEXT: |
6143
87e99d425124
(svn r8509) -Cleanup: Add some enum names to the create scenario window
Darkvater
parents:
5919
diff
changeset
|
697 |
InvalidateWidget(w, CSCEN_FLAT_LAND_HEIGHT_TEXT); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
698 |
_patches_newgame.se_flat_world_height = clamp(value, 0, 15); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
699 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
700 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
701 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
702 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
703 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
704 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
705 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
706 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
707 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
708 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
709 |
static const Widget _create_scenario_widgets[] = { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
710 |
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
711 |
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 337, 0, 13, STR_SE_CAPTION, STR_NULL}, |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
712 |
{ WWT_PANEL, RESIZE_NONE, 13, 0, 337, 14, 169, 0x0, STR_NULL}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
713 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
714 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 10, 86, 24, 78, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
715 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 90, 166, 24, 78, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
716 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 170, 246, 24, 78, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE}, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
717 |
{ WWT_IMGBTN_2, RESIZE_NONE, 12, 250, 326, 24, 78, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
718 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
719 |
{ WWT_TEXTBTN, RESIZE_NONE, 6, 12, 115, 95, 124, STR_SE_FLAT_WORLD, STR_SE_FLAT_WORLD_TIP}, // Empty (sea-level) map |
d34703513ed0
(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
parents:
6144
diff
changeset
|
720 |
{ WWT_TEXTBTN, RESIZE_NONE, 6, 12, 115, 131, 160, STR_SE_RANDOM_LAND, STR_022A_GENERATE_RANDOM_LAND}, // Generate |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
721 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
722 |
{ WWT_PANEL, RESIZE_NONE, 12, 216, 251, 95, 106, 0x0, STR_NULL}, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
723 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 252, 263, 95, 106, STR_0225, STR_NULL}, // Mapsize X |
d34703513ed0
(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
parents:
6144
diff
changeset
|
724 |
{ WWT_PANEL, RESIZE_NONE, 12, 279, 314, 95, 106, 0x0, STR_NULL}, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
725 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 315, 326, 95, 106, STR_0225, STR_NULL}, // Mapsize Y |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
726 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
727 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 216, 227, 113, 124, SPR_ARROW_DOWN, STR_029E_MOVE_THE_STARTING_DATE}, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
728 |
{ WWT_PANEL, RESIZE_NONE, 12, 228, 314, 113, 124, 0x0, STR_NULL}, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
729 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 113, 124, SPR_ARROW_UP, STR_029F_MOVE_THE_STARTING_DATE}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
730 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
731 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 282, 293, 131, 142, SPR_ARROW_DOWN, STR_FLAT_WORLD_HEIGHT_DOWN}, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
732 |
{ WWT_PANEL, RESIZE_NONE, 12, 294, 314, 131, 142, 0x0, STR_NULL}, |
d34703513ed0
(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
parents:
6144
diff
changeset
|
733 |
{ WWT_IMGBTN, RESIZE_NONE, 12, 315, 326, 131, 142, SPR_ARROW_UP, STR_FLAT_WORLD_HEIGHT_UP}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
734 |
{ WIDGETS_END}, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
735 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
736 |
|
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
737 |
static const WindowDesc _create_scenario_desc = { |
d34703513ed0
(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
parents:
6144
diff
changeset
|
738 |
WDP_CENTER, WDP_CENTER, 338, 170, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6143
diff
changeset
|
739 |
WC_GENERATE_LANDSCAPE, WC_NONE, |
6145
d34703513ed0
(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
parents:
6144
diff
changeset
|
740 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
741 |
_create_scenario_widgets, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
742 |
CreateScenarioWndProc, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
743 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
744 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
745 |
void ShowCreateScenario() |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
746 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
747 |
DeleteWindowByClass(WC_GENERATE_LANDSCAPE); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
748 |
AllocateWindowDescFront(&_create_scenario_desc, GLWP_SCENARIO); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
749 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
750 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
751 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
752 |
static const Widget _show_terrain_progress_widgets[] = { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
753 |
{ WWT_CAPTION, RESIZE_NONE, 14, 0, 180, 0, 13, STR_GENERATION_WORLD, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
754 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 180, 14, 96, 0x0, STR_NULL}, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
755 |
{ WWT_TEXTBTN, RESIZE_NONE, 15, 20, 161, 74, 85, STR_GENERATION_ABORT, STR_NULL}, // Abort button |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
756 |
{ WIDGETS_END}, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
757 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
758 |
|
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
759 |
struct tp_info { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
760 |
uint percent; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
761 |
StringID cls; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
762 |
uint current; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
763 |
uint total; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
764 |
int timer; |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
765 |
}; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
766 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
767 |
static tp_info _tp; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
768 |
|
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
769 |
static void AbortGeneratingWorldCallback(Window *w, bool confirmed) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
770 |
{ |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
771 |
if (confirmed) { |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
772 |
AbortGeneratingWorld(); |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
773 |
} else if (IsGeneratingWorld() && !IsGeneratingWorldAborted()) { |
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5838
diff
changeset
|
774 |
SetMouseCursor(SPR_CURSOR_ZZZ, PAL_NONE); |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
775 |
} |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
776 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
777 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
778 |
static void ShowTerrainProgressProc(Window* w, WindowEvent* e) |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
779 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
780 |
switch (e->event) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
781 |
case WE_CLICK: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4609
diff
changeset
|
782 |
switch (e->we.click.widget) { |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
783 |
case 2: |
5919
2b58160d667d
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5838
diff
changeset
|
784 |
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE); |
5669
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
785 |
ShowQuery( |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
786 |
STR_GENERATION_ABORT_CAPTION, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
787 |
STR_GENERATION_ABORT_MESSAGE, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
788 |
w, |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
789 |
AbortGeneratingWorldCallback |
ea25407ffa55
(svn r7621) -Codechange: Rework ShowQuery into a general modal popup window. It gets passed
Darkvater
parents:
5568
diff
changeset
|
790 |
); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
791 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
792 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
793 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
794 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
795 |
case WE_PAINT: |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
796 |
DrawWindowWidgets(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
797 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
798 |
/* Draw the % complete with a bar and a text */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
799 |
DrawFrameRect(19, 20, (w->width - 18), 37, 14, FR_BORDERONLY); |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
800 |
DrawFrameRect(20, 21, (int)((w->width - 40) * _tp.percent / 100) + 20, 36, 10, FR_NONE); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
801 |
SetDParam(0, _tp.percent); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
802 |
DrawStringCentered(90, 25, STR_PROGRESS, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
803 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
804 |
/* Tell which class we are generating */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
805 |
DrawStringCentered(90, 46, _tp.cls, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
806 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
807 |
/* And say where we are in that class */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
808 |
SetDParam(0, _tp.current); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
809 |
SetDParam(1, _tp.total); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
810 |
DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
811 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
812 |
SetWindowDirty(w); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
813 |
break; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
814 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
815 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
816 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
817 |
static const WindowDesc _show_terrain_progress_desc = { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
818 |
WDP_CENTER, WDP_CENTER, 181, 97, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6143
diff
changeset
|
819 |
WC_GENERATE_PROGRESS_WINDOW, WC_NONE, |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
820 |
WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
821 |
_show_terrain_progress_widgets, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
822 |
ShowTerrainProgressProc |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
823 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
824 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
825 |
/** |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
826 |
* Initializes the progress counters to the starting point. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
827 |
*/ |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
828 |
void PrepareGenerateWorldProgress() |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
829 |
{ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
830 |
_tp.cls = STR_WORLD_GENERATION; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
831 |
_tp.current = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
832 |
_tp.total = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
833 |
_tp.percent = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
834 |
_tp.timer = 0; // Forces to paint the progress window immediatelly |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
835 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
836 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
837 |
/** |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
838 |
* Show the window where a user can follow the process of the map generation. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
839 |
*/ |
9895
7bd07f43b0e3
(svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents:
6505
diff
changeset
|
840 |
void ShowGenerateWorldProgress() |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
841 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
842 |
AllocateWindowDescFront(&_show_terrain_progress_desc, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
843 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
844 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
845 |
static void _SetGeneratingWorldProgress(gwp_class cls, uint progress, uint total) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
846 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
847 |
static const int percent_table[GWP_CLASS_COUNT + 1] = {0, 5, 15, 20, 40, 60, 65, 80, 85, 99, 100 }; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
848 |
static const StringID class_table[GWP_CLASS_COUNT] = { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
849 |
STR_WORLD_GENERATION, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
850 |
STR_022E_LANDSCAPE_GENERATION, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
851 |
STR_CLEARING_TILES, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
852 |
STR_022F_TOWN_GENERATION, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
853 |
STR_0230_INDUSTRY_GENERATION, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
854 |
STR_UNMOVABLE_GENERATION, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
855 |
STR_TREE_GENERATION, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
856 |
STR_SETTINGUP_GAME, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
857 |
STR_PREPARING_TILELOOP, |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
858 |
STR_PREPARING_GAME |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
859 |
}; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
860 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
861 |
assert(cls < GWP_CLASS_COUNT); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
862 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
863 |
/* Do not run this function if we aren't in a thread */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
864 |
if (!IsGenerateWorldThreaded() && !_network_dedicated) return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
865 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
866 |
if (IsGeneratingWorldAborted()) HandleGeneratingWorldAbortion(); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
867 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
868 |
if (total == 0) { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
869 |
assert(_tp.cls == class_table[cls]); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
870 |
_tp.current += progress; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
871 |
} else { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
872 |
_tp.cls = class_table[cls]; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
873 |
_tp.current = progress; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
874 |
_tp.total = total; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
875 |
_tp.percent = percent_table[cls]; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
876 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
877 |
|
5052
afa697e85f79
(svn r7102) -Codechange: Remove and hardcode unnecessary patch setting progress_update_interval
peter1138
parents:
5048
diff
changeset
|
878 |
/* Don't update the screen too often. So update it once in every 200ms. |
afa697e85f79
(svn r7102) -Codechange: Remove and hardcode unnecessary patch setting progress_update_interval
peter1138
parents:
5048
diff
changeset
|
879 |
* However, the _tick_counter increases by 8 every 30ms, so compensate |
afa697e85f79
(svn r7102) -Codechange: Remove and hardcode unnecessary patch setting progress_update_interval
peter1138
parents:
5048
diff
changeset
|
880 |
* for that. */ |
afa697e85f79
(svn r7102) -Codechange: Remove and hardcode unnecessary patch setting progress_update_interval
peter1138
parents:
5048
diff
changeset
|
881 |
if (!_network_dedicated && _tp.timer != 0 && _timer_counter - _tp.timer < (200 * 8 / 30)) return; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
882 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
883 |
/* Percentage is about the number of completed tasks, so 'current - 1' */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
884 |
_tp.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_tp.current == 0 ? 0 : _tp.current - 1) / _tp.total; |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
885 |
_tp.timer = _timer_counter; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
886 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
887 |
if (_network_dedicated) { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
888 |
static uint last_percent = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
889 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
890 |
/* Never display 0% */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
891 |
if (_tp.percent == 0) return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
892 |
/* Reset if percent is lower then the last recorded */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
893 |
if (_tp.percent < last_percent) last_percent = 0; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
894 |
/* Display every 5%, but 6% is also very valid.. just not smaller steps then 5% */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
895 |
if (_tp.percent % 5 != 0 && _tp.percent <= last_percent + 5) return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
896 |
/* Never show steps smaller then 2%, even if it is a mod 5% */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
897 |
if (_tp.percent <= last_percent + 2) return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
898 |
|
5568
75f13d7bfaed
(svn r7565) -Codechange: Rework DEBUG functionality. Look for appropiate debugging levels to
Darkvater
parents:
5228
diff
changeset
|
899 |
DEBUG(net, 1, "Map generation percentage complete: %d", _tp.percent); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
900 |
last_percent = _tp.percent; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
901 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
902 |
/* Don't continue as dedicated never has a thread running */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
903 |
return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
904 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
905 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
906 |
InvalidateWindow(WC_GENERATE_PROGRESS_WINDOW, 0); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
907 |
MarkWholeScreenDirty(); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
908 |
SetGeneratingWorldPaintStatus(true); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
909 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
910 |
/* We wait here till the paint is done, so we don't read and write |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
911 |
* on the same tile at the same moment. Nasty hack, but that happens |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
912 |
* if you implement threading afterwards */ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
913 |
while (IsGeneratingWorldReadyForPaint()) { CSleep(10); } |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
914 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
915 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
916 |
/** |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
917 |
* Set the total of a stage of the world generation. |
9909
dce9a6923bb7
(svn r10133) [gamebalance] -Sync: r9620:9670 from trunk
celestar
parents:
9906
diff
changeset
|
918 |
* @param cls the current class we are in. |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
919 |
* @param total Set the total expected items for this class. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
920 |
* |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
921 |
* Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
922 |
* Also, progress works if total is zero, total works if progress is zero. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
923 |
*/ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
924 |
void SetGeneratingWorldProgress(gwp_class cls, uint total) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
925 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
926 |
if (total == 0) return; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
927 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
928 |
_SetGeneratingWorldProgress(cls, 0, total); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
929 |
} |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
930 |
|
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
931 |
/** |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
932 |
* Increases the current stage of the world generation with one. |
9909
dce9a6923bb7
(svn r10133) [gamebalance] -Sync: r9620:9670 from trunk
celestar
parents:
9906
diff
changeset
|
933 |
* @param cls the current class we are in. |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
934 |
* |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
935 |
* Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
936 |
* Also, progress works if total is zero, total works if progress is zero. |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
937 |
*/ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
938 |
void IncreaseGeneratingWorldProgress(gwp_class cls) |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
939 |
{ |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
940 |
/* In fact the param 'class' isn't needed.. but for some security reasons, we want it around */ |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5835
diff
changeset
|
941 |
_SetGeneratingWorldProgress(cls, 1, 0); |
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
diff
changeset
|
942 |
} |