OpenTTD

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