OpenTTD Source: src/intro_gui.cpp Source File

OpenTTD Source 12.0-beta1

intro_gui.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #include "stdafx.h"
11 #include "error.h"
12 #include "gui.h"
13 #include "window_gui.h"
14 #include "textbuf_gui.h"
15 #include "network/network.h"
16 #include "genworld.h"
17 #include "network/network_gui.h"
18 #include "network/network_content.h"
19 #include "landscape_type.h"
20 #include "strings_func.h"
21 #include "fios.h"
22 #include "ai/ai_gui.hpp"
23 #include "gfx_func.h"
24 #include "core/geometry_func.hpp"
25 #include "language.h"
26 #include "rev.h"
27 #include "highscore.h"
28
29 #include "widgets/intro_widget.h"
30
31 #include "table/strings.h"
32 #include "table/sprites.h"
33
34 #include "safeguards.h"
35
36 struct SelectGameWindow : public Window {
37
38 SelectGameWindow(WindowDesc *desc) : Window(desc)
39 {
40 this->CreateNestedTree();
41 this->FinishInitNested(0);
42 this->OnInvalidateData();
43 }
44
50 void OnInvalidateData(int data = 0, bool gui_scope = true) override
51 {
52 if (!gui_scope) return;
53 this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
54 this->SetWidgetLoweredState(WID_SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC);
55 this->SetWidgetLoweredState(WID_SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC);
56 this->SetWidgetLoweredState(WID_SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND);
57 }
58
59 void OnInit() override
60 {
61 bool missing_sprites = _missing_extra_graphics > 0 && !IsReleasedVersion();
62 this->GetWidget<NWidgetStacked>(WID_SGI_BASESET_SELECTION)->SetDisplayedPlane(missing_sprites ? 0 : SZSP_NONE);
63
64 bool missing_lang = _current_language->missing >= _settings_client.gui.missing_strings_threshold && !IsReleasedVersion();
65 this->GetWidget<NWidgetStacked>(WID_SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing_lang ? 0 : SZSP_NONE);
66 }
67
68 void DrawWidget(const Rect &r, int widget) const override
69 {
70 switch (widget) {
71 case WID_SGI_BASESET:
72 SetDParam(0, _missing_extra_graphics);
73 DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_BASESET, TC_FROMSTRING, SA_CENTER);
74 break;
75
76 case WID_SGI_TRANSLATION:
77 SetDParam(0, _current_language->missing);
78 DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_TRANSLATION, TC_FROMSTRING, SA_CENTER);
79 break;
80 }
81 }
82
83 void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
84 {
85 StringID str = 0;
86 switch (widget) {
87 case WID_SGI_BASESET:
88 SetDParam(0, _missing_extra_graphics);
89 str = STR_INTRO_BASESET;
90 break;
91
92 case WID_SGI_TRANSLATION:
93 SetDParam(0, _current_language->missing);
94 str = STR_INTRO_TRANSLATION;
95 break;
96 }
97
98 if (str != 0) {
99 int height = GetStringHeight(str, size->width);
100 if (height > 3 * FONT_HEIGHT_NORMAL) {
101 /* Don't let the window become too high. */
102 Dimension textdim = GetStringBoundingBox(str);
103 textdim.height *= 3;
104 textdim.width -= textdim.width / 2;
105 *size = maxdim(*size, textdim);
106 } else {
107 size->height = height + padding.height;
108 }
109 }
110 }
111
112 void OnClick(Point pt, int widget, int click_count) override
113 {
114 /* Do not create a network server when you (just) have closed one of the game
115 * creation/load windows for the network server. */
116 if (IsInsideMM(widget, WID_SGI_GENERATE_GAME, WID_SGI_EDIT_SCENARIO + 1)) _is_network_server = false;
117
118 switch (widget) {
119 case WID_SGI_GENERATE_GAME:
120 if (_ctrl_pressed) {
121 StartNewGameWithoutGUI(GENERATE_NEW_SEED);
122 } else {
123 ShowGenerateLandscape();
124 }
125 break;
126
127 case WID_SGI_LOAD_GAME: ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD); break;
128 case WID_SGI_PLAY_SCENARIO: ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD); break;
129 case WID_SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); break;
130 case WID_SGI_EDIT_SCENARIO: StartScenarioEditor(); break;
131
132 case WID_SGI_PLAY_NETWORK:
133 if (!_network_available) {
134 ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
135 } else {
136 ShowNetworkGameWindow();
137 }
138 break;
139
140 case WID_SGI_TEMPERATE_LANDSCAPE: case WID_SGI_ARCTIC_LANDSCAPE:
141 case WID_SGI_TROPIC_LANDSCAPE: case WID_SGI_TOYLAND_LANDSCAPE:
142 SetNewLandscapeType(widget - WID_SGI_TEMPERATE_LANDSCAPE);
143 break;
144
145 case WID_SGI_OPTIONS: ShowGameOptions(); break;
146 case WID_SGI_HIGHSCORE: ShowHighscoreTable(); break;
147 case WID_SGI_SETTINGS_OPTIONS:ShowGameSettings(); break;
148 case WID_SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
149 case WID_SGI_CONTENT_DOWNLOAD:
150 if (!_network_available) {
151 ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
152 } else {
153 ShowNetworkContentListWindow();
154 }
155 break;
156 case WID_SGI_AI_SETTINGS: ShowAIConfigWindow(); break;
157 case WID_SGI_EXIT: HandleExitGameRequest(); break;
158 }
159 }
160 };
161
162 static const NWidgetPart _nested_select_game_widgets[] = {
163 NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_INTRO_CAPTION, STR_NULL),
164 NWidget(WWT_PANEL, COLOUR_BROWN),
165 NWidget(NWID_SPACER), SetMinimalSize(0, 8),
166
167 /* 'generate game' and 'load game' buttons */
168 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
169 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_GENERATE_GAME), SetMinimalSize(158, 12),
170 SetDataTip(STR_INTRO_NEW_GAME, STR_INTRO_TOOLTIP_NEW_GAME), SetPadding(0, 0, 0, 10), SetFill(1, 0),
171 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_LOAD_GAME), SetMinimalSize(158, 12),
172 SetDataTip(STR_INTRO_LOAD_GAME, STR_INTRO_TOOLTIP_LOAD_GAME), SetPadding(0, 10, 0, 0), SetFill(1, 0),
173 EndContainer(),
174
175 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
176
177 /* 'play scenario' and 'play heightmap' buttons */
178 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
179 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_SCENARIO), SetMinimalSize(158, 12),
180 SetDataTip(STR_INTRO_PLAY_SCENARIO, STR_INTRO_TOOLTIP_PLAY_SCENARIO), SetPadding(0, 0, 0, 10), SetFill(1, 0),
181 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_HEIGHTMAP), SetMinimalSize(158, 12),
182 SetDataTip(STR_INTRO_PLAY_HEIGHTMAP, STR_INTRO_TOOLTIP_PLAY_HEIGHTMAP), SetPadding(0, 10, 0, 0), SetFill(1, 0),
183 EndContainer(),
184
185 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
186
187 /* 'edit scenario' and 'play multiplayer' buttons */
188 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
189 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_EDIT_SCENARIO), SetMinimalSize(158, 12),
190 SetDataTip(STR_INTRO_SCENARIO_EDITOR, STR_INTRO_TOOLTIP_SCENARIO_EDITOR), SetPadding(0, 0, 0, 10), SetFill(1, 0),
191 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_NETWORK), SetMinimalSize(158, 12),
192 SetDataTip(STR_INTRO_MULTIPLAYER, STR_INTRO_TOOLTIP_MULTIPLAYER), SetPadding(0, 10, 0, 0), SetFill(1, 0),
193 EndContainer(),
194
195 NWidget(NWID_SPACER), SetMinimalSize(0, 7),
196
197 /* climate selection buttons */
198 NWidget(NWID_HORIZONTAL),
199 NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0),
200 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TEMPERATE_LANDSCAPE), SetMinimalSize(77, 55),
201 SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
202 NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
203 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_ARCTIC_LANDSCAPE), SetMinimalSize(77, 55),
204 SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
205 NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
206 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TROPIC_LANDSCAPE), SetMinimalSize(77, 55),
207 SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
208 NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
209 NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TOYLAND_LANDSCAPE), SetMinimalSize(77, 55),
210 SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
211 NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0),
212 EndContainer(),
213
214 NWidget(NWID_SPACER), SetMinimalSize(0, 7),
215 NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_BASESET_SELECTION),
216 NWidget(NWID_VERTICAL),
217 NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_BASESET), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10),
218 EndContainer(),
219 EndContainer(),
220 NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_TRANSLATION_SELECTION),
221 NWidget(NWID_VERTICAL),
222 NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_TRANSLATION), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10),
223 EndContainer(),
224 EndContainer(),
225
226 /* 'game options' and 'advanced settings' buttons */
227 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
228 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_OPTIONS), SetMinimalSize(158, 12),
229 SetDataTip(STR_INTRO_GAME_OPTIONS, STR_INTRO_TOOLTIP_GAME_OPTIONS), SetPadding(0, 0, 0, 10), SetFill(1, 0),
230 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_SETTINGS_OPTIONS), SetMinimalSize(158, 12),
231 SetDataTip(STR_INTRO_CONFIG_SETTINGS_TREE, STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE), SetPadding(0, 10, 0, 0), SetFill(1, 0),
232 EndContainer(),
233
234 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
235
236 /* 'script settings' and 'newgrf settings' buttons */
237 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
238 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_AI_SETTINGS), SetMinimalSize(158, 12),
239 SetDataTip(STR_INTRO_SCRIPT_SETTINGS, STR_INTRO_TOOLTIP_SCRIPT_SETTINGS), SetPadding(0, 0, 0, 10), SetFill(1, 0),
240 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_GRF_SETTINGS), SetMinimalSize(158, 12),
241 SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_INTRO_TOOLTIP_NEWGRF_SETTINGS), SetPadding(0, 10, 0, 0), SetFill(1, 0),
242 EndContainer(),
243
244 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
245
246 /* 'online content' and 'highscore' buttons */
247 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
248 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_CONTENT_DOWNLOAD), SetMinimalSize(158, 12),
249 SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), SetPadding(0, 0, 0, 10), SetFill(1, 0),
250 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_HIGHSCORE), SetMinimalSize(158, 12),
251 SetDataTip(STR_INTRO_HIGHSCORE, STR_INTRO_TOOLTIP_HIGHSCORE), SetPadding(0, 10, 0, 0), SetFill(1, 0),
252 EndContainer(),
253
254 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
255
256 /* 'exit program' button */
257 NWidget(NWID_HORIZONTAL),
258 NWidget(NWID_SPACER), SetFill(1, 0),
259 NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_EXIT), SetMinimalSize(128, 12),
260 SetDataTip(STR_INTRO_QUIT, STR_INTRO_TOOLTIP_QUIT),
261 NWidget(NWID_SPACER), SetFill(1, 0),
262 EndContainer(),
263
264 NWidget(NWID_SPACER), SetMinimalSize(0, 8),
265
266 EndContainer(),
267 };
268
269 static WindowDesc _select_game_desc(
270 WDP_CENTER, nullptr, 0, 0,
271 WC_SELECT_GAME, WC_NONE,
272 0,
273 _nested_select_game_widgets, lengthof(_nested_select_game_widgets)
274 );
275
276 void ShowSelectGameWindow()
277 {
278 new SelectGameWindow(&_select_game_desc);
279 }
280
281 static void AskExitGameCallback(Window *w, bool confirmed)
282 {
283 if (confirmed) _exit_game = true;
284 }
285
286 void AskExitGame()
287 {
288 ShowQuery(
289 STR_QUIT_CAPTION,
290 STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
291 nullptr,
292 AskExitGameCallback
293 );
294 }
295
296
297 static void AskExitToGameMenuCallback(Window *w, bool confirmed)
298 {
299 if (confirmed) {
300 _switch_mode = SM_MENU;
301 ClearErrorMessages();
302 }
303 }
304
305 void AskExitToGameMenu()
306 {
307 ShowQuery(
308 STR_ABANDON_GAME_CAPTION,
309 (_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
310 nullptr,
311 AskExitToGameMenuCallback
312 );
313 }
SZSP_NONE
@ SZSP_NONE
Display plane with zero size in both directions (none filling and resizing).
Definition: widget_type.h:423
ShowNewGRFSettings
void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config)
Setup the NewGRF gui.
Definition: newgrf_gui.cpp:1995
network_content.h
LanguagePackHeader::missing
uint16 missing
number of missing strings.
Definition: language.h:40
WWT_IMGBTN_2
@ WWT_IMGBTN_2
(Toggle) Button with diff image when clicked
Definition: widget_type.h:51
FT_SCENARIO
@ FT_SCENARIO
old or new scenario
Definition: fileio_type.h:19
landscape_type.h
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
SetPadding
static NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
Widget part function for setting additional space around a widget.
Definition: widget_type.h:1139
WID_SGI_TOYLAND_LANDSCAPE
@ WID_SGI_TOYLAND_LANDSCAPE
Select toyland landscape button.
Definition: intro_widget.h:24
GameCreationSettings::landscape
byte landscape
the landscape we're currently in
Definition: settings_type.h:320
WID_SGI_EXIT
@ WID_SGI_EXIT
Exit button.
Definition: intro_widget.h:35
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
WC_SELECT_GAME
@ WC_SELECT_GAME
Select game window; Window numbers:
Definition: window_type.h:434
Window::CreateNestedTree
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1760
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
WID_SGI_PLAY_SCENARIO
@ WID_SGI_PLAY_SCENARIO
Play scenario button.
Definition: intro_widget.h:17
SelectGameWindow
Definition: intro_gui.cpp:36
ShowNetworkContentListWindow
void ShowNetworkContentListWindow(ContentVector *cv=nullptr, ContentType type1=CONTENT_TYPE_END, ContentType type2=CONTENT_TYPE_END)
Show the content list window with a given set of content.
Definition: network_content_gui.cpp:1113
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
ai_gui.hpp
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:35
ShowGameOptions
void ShowGameOptions()
Open the game options window.
Definition: settings_gui.cpp:745
ShowGameSettings
void ShowGameSettings()
Open advanced settings window.
Definition: settings_gui.cpp:2485
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:52
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget array.
Definition: widget_type.h:46
network_gui.h
fios.h
StartScenarioEditor
void StartScenarioEditor()
Start with a scenario editor.
Definition: genworld_gui.cpp:1012
Window::Window
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
Definition: window.cpp:1799
SetDParam
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:196
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:971
GENERATE_NEW_SEED
static const uint32 GENERATE_NEW_SEED
Create a new random seed.
Definition: genworld.h:24
genworld.h
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1107
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:888
textbuf_gui.h
ShowErrorMessage
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=nullptr, uint textref_stack_size=0, const uint32 *textref_stack=nullptr)
Display an error message in a window.
Definition: error_gui.cpp:383
DrawStringMultiLine
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Definition: gfx.cpp:787
WID_SGI_ARCTIC_LANDSCAPE
@ WID_SGI_ARCTIC_LANDSCAPE
Select arctic landscape button.
Definition: intro_widget.h:22
GameSettings::game_creation
GameCreationSettings game_creation
settings used during the creation of a game (map)
Definition: settings_type.h:576
WID_SGI_HIGHSCORE
@ WID_SGI_HIGHSCORE
Highscore button.
Definition: intro_widget.h:30
IsInsideMM
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
Definition: math_func.hpp:204
gfx_func.h
WindowDesc
High level window description.
Definition: window_gui.h:168
SelectGameWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: intro_gui.cpp:112
window_gui.h
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:463
WID_SGI_GRF_SETTINGS
@ WID_SGI_GRF_SETTINGS
NewGRF button.
Definition: intro_widget.h:32
ClearErrorMessages
void ClearErrorMessages()
Clear all errors from the queue.
Definition: error_gui.cpp:341
SLO_LOAD
@ SLO_LOAD
File is being loaded.
Definition: fileio_type.h:49
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
ShowGenerateLandscape
void ShowGenerateLandscape()
Start with a normal game.
Definition: genworld_gui.cpp:1000
WID_SGI_CONTENT_DOWNLOAD
@ WID_SGI_CONTENT_DOWNLOAD
Content Download button.
Definition: intro_widget.h:33
Window::height
int height
Height of the window (number of pixels down in y direction)
Definition: window_gui.h:315
highscore.h
_missing_extra_graphics
uint _missing_extra_graphics
Number of sprites provided by the fallback extra GRF, i.e. missing in the baseset.
Definition: newgrf_config.cpp:174
WID_SGI_PLAY_NETWORK
@ WID_SGI_PLAY_NETWORK
Play network button.
Definition: intro_widget.h:20
GUISettings::missing_strings_threshold
byte missing_strings_threshold
the number of missing strings before showing the warning
Definition: settings_type.h:165
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
_current_language
const LanguageMetadata * _current_language
The currently loaded language.
Definition: strings.cpp:46
safeguards.h
WID_SGI_LOAD_GAME
@ WID_SGI_LOAD_GAME
Load game button.
Definition: intro_widget.h:16
WID_SGI_TEMPERATE_LANDSCAPE
@ WID_SGI_TEMPERATE_LANDSCAPE
Select temperate landscape button.
Definition: intro_widget.h:21
WID_SGI_TRANSLATION_SELECTION
@ WID_SGI_TRANSLATION_SELECTION
Translation selection.
Definition: intro_widget.h:27
sprites.h
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
error.h
language.h
stdafx.h
ShowSaveLoadDialog
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
Launch save/load dialog in the given mode.
Definition: fios_gui.cpp:921
FT_SAVEGAME
@ FT_SAVEGAME
old or new savegame
Definition: fileio_type.h:18
WID_SGI_TRANSLATION
@ WID_SGI_TRANSLATION
Translation errors.
Definition: intro_widget.h:28
StartNewGameWithoutGUI
void StartNewGameWithoutGUI(uint32 seed)
Start a normal game without the GUI.
Definition: genworld_gui.cpp:1021
WC_NONE
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
Definition: window_type.h:37
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
WID_SGI_BASESET_SELECTION
@ WID_SGI_BASESET_SELECTION
Baseset selection.
Definition: intro_widget.h:25
GetStringHeight
int GetStringHeight(const char *str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Definition: gfx.cpp:713
ShowHighscoreTable
void ShowHighscoreTable(int difficulty=SP_CUSTOM, int8 rank=-1)
Show the highscore table for a given difficulty.
Definition: highscore_gui.cpp:233
_switch_mode
SwitchMode _switch_mode
The next mainloop command.
Definition: gfx.cpp:46
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
ShowQuery
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the ce...
Definition: misc_gui.cpp:1267
rev.h
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1092
WID_SGI_GENERATE_GAME
@ WID_SGI_GENERATE_GAME
Generate game button.
Definition: intro_widget.h:15
strings_func.h
FONT_HEIGHT_NORMAL
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:165
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1207
SelectGameWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: intro_gui.cpp:68
geometry_func.hpp
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1010
SetNewLandscapeType
void SetNewLandscapeType(byte landscape)
Changes landscape type and sets genworld window dirty.
Definition: genworld_gui.cpp:61
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
WID_SGI_AI_SETTINGS
@ WID_SGI_AI_SETTINGS
AI button.
Definition: intro_widget.h:34
FT_HEIGHTMAP
@ FT_HEIGHTMAP
heightmap file
Definition: fileio_type.h:20
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1776
NWID_SPACER
@ NWID_SPACER
Invisible widget that takes some space.
Definition: widget_type.h:77
WID_SGI_SETTINGS_OPTIONS
@ WID_SGI_SETTINGS_OPTIONS
Settings button.
Definition: intro_widget.h:31
WL_ERROR
@ WL_ERROR
Errors (eg. saving/loading failed)
Definition: error.h:24
SM_MENU
@ SM_MENU
Switch to game intro menu.
Definition: openttd.h:32
WID_SGI_PLAY_HEIGHTMAP
@ WID_SGI_PLAY_HEIGHTMAP
Play heightmap button.
Definition: intro_widget.h:18
network.h
SA_CENTER
@ SA_CENTER
Center both horizontally and vertically.
Definition: gfx_type.h:338
SelectGameWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: intro_gui.cpp:50
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:378
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1076
gui.h
Window
Data structure for an opened window.
Definition: window_gui.h:279
_network_available
bool _network_available
is network mode available?
Definition: network.cpp:58
WID_SGI_EDIT_SCENARIO
@ WID_SGI_EDIT_SCENARIO
Edit scenario button.
Definition: intro_widget.h:19
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition: widget_type.h:78
ShowAIConfigWindow
void ShowAIConfigWindow()
Open the AI config window.
Definition: ai_gui.cpp:973
intro_widget.h
WID_SGI_OPTIONS
@ WID_SGI_OPTIONS
Options button.
Definition: intro_widget.h:29
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:47
SelectGameWindow::OnInit
void OnInit() override
Notification that the nested widget tree gets initialized.
Definition: intro_gui.cpp:59
SelectGameWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: intro_gui.cpp:83
WDP_CENTER
@ WDP_CENTER
Center the window.
Definition: window_gui.h:157
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:447
_is_network_server
bool _is_network_server
Does this client wants to be a network-server?
Definition: network.cpp:60
_settings_newgame
GameSettings _settings_newgame
Game settings for new games (updated from the intro screen).
Definition: settings.cpp:54
INVALID_STRING_ID
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition: strings_type.h:17
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:593
WID_SGI_BASESET
@ WID_SGI_BASESET
Baseset errors.
Definition: intro_widget.h:26
_grfconfig_newgame
GRFConfig * _grfconfig_newgame
First item in list of default GRF set up.
Definition: newgrf_config.cpp:172
WID_SGI_TROPIC_LANDSCAPE
@ WID_SGI_TROPIC_LANDSCAPE
Select tropic landscape button.
Definition: intro_widget.h:23