Files
@ r22617:3fbb83cf1ddc
Branch filter:
Location: cpp/openttd-patchpack/source/src/intro_gui.cpp - annotation
r22617:3fbb83cf1ddc
12.5 KiB
text/x-c
(svn r27828) -Update from Eints:
croatian: 2 changes by VoyagerOne
italian: 6 changes by lorenzodv
english (us): 15 changes by Supercheese
latin: 15 changes by Supercheese
croatian: 2 changes by VoyagerOne
italian: 6 changes by lorenzodv
english (us): 15 changes by Supercheese
latin: 15 changes by Supercheese
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | r5584:545d748cc681 r5584:545d748cc681 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r6201:2e76eb9a1d7a r5584:545d748cc681 r18617:524f2e0f54dc r5584:545d748cc681 r8107:82461791b7a2 r8107:82461791b7a2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10793:5ba2151e71e9 r10960:e97ebf9cf99b r8114:866ed489ed98 r8149:8a97dd280f35 r10840:7a608f4ad153 r11335:c7c33f62d918 r14248:a9050881acd7 r17988:0007c249e812 r17988:0007c249e812 r19836:9d82dfe1ad85 r5584:545d748cc681 r18670:f122c356353c r18670:f122c356353c r8264:d493cb51fe8a r8264:d493cb51fe8a r8264:d493cb51fe8a r21383:942c32fb8b0e r21383:942c32fb8b0e r9282:cec57957cd97 r8365:25892c76d49b r20280:ca1fc41725ff r9282:cec57957cd97 r20280:ca1fc41725ff r20280:ca1fc41725ff r15227:6ee8e499e653 r9282:cec57957cd97 r5584:545d748cc681 r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r17476:d3b7a183536d r9282:cec57957cd97 r17476:d3b7a183536d r18678:159c537f5381 r18678:159c537f5381 r18678:159c537f5381 r18678:159c537f5381 r12263:5b872c6d772b r12263:5b872c6d772b r17988:0007c249e812 r17988:0007c249e812 r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r18678:159c537f5381 r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r17988:0007c249e812 r13695:e0bf1a35834a r12313:f8317da11c46 r22525:8b64738b95fa r17988:0007c249e812 r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r17988:0007c249e812 r22525:8b64738b95fa r17988:0007c249e812 r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r17988:0007c249e812 r12313:f8317da11c46 r12313:f8317da11c46 r12313:f8317da11c46 r14399:3f819c0da60a r9282:cec57957cd97 r6898:350481a50abc r9282:cec57957cd97 r9282:cec57957cd97 r18678:159c537f5381 r6898:350481a50abc r6555:9ef973fe9db5 r9282:cec57957cd97 r18678:159c537f5381 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r22446:e215802a4b89 r22446:e215802a4b89 r22446:e215802a4b89 r18678:159c537f5381 r8365:25892c76d49b r18678:159c537f5381 r9282:cec57957cd97 r14635:a75264d517b7 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r8365:25892c76d49b r18678:159c537f5381 r18678:159c537f5381 r18678:159c537f5381 r9282:cec57957cd97 r8365:25892c76d49b r18678:159c537f5381 r19836:9d82dfe1ad85 r18678:159c537f5381 r18678:159c537f5381 r18678:159c537f5381 r10793:5ba2151e71e9 r14635:a75264d517b7 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r18678:159c537f5381 r18678:159c537f5381 r9282:cec57957cd97 r5584:545d748cc681 r9282:cec57957cd97 r5584:545d748cc681 r11457:9a04ad49bedb r13742:180ad925befc r13745:49505a0400d8 r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r22525:8b64738b95fa r18678:159c537f5381 r17988:0007c249e812 r18678:159c537f5381 r17988:0007c249e812 r17988:0007c249e812 r11457:9a04ad49bedb r19836:9d82dfe1ad85 r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r19836:9d82dfe1ad85 r21834:89a4bfdf1369 r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r19836:9d82dfe1ad85 r13742:180ad925befc r19836:9d82dfe1ad85 r19836:9d82dfe1ad85 r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r19836:9d82dfe1ad85 r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r19836:9d82dfe1ad85 r19836:9d82dfe1ad85 r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r13742:180ad925befc r13742:180ad925befc r18678:159c537f5381 r13742:180ad925befc r13742:180ad925befc r13742:180ad925befc r11457:9a04ad49bedb r13742:180ad925befc r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r11457:9a04ad49bedb r20280:ca1fc41725ff r20283:2a199c78224c r5893:6c4fd9987e0f r19745:d8f95208ad9e r11457:9a04ad49bedb r11368:058349c3a02c r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r9282:cec57957cd97 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r8424:8ec8538eb70c r5584:545d748cc681 r8424:8ec8538eb70c r5584:545d748cc681 r5584:545d748cc681 r13095:c8ad2bbbdb3b r13095:c8ad2bbbdb3b r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6221:8bdd0aa79256 r6221:8bdd0aa79256 r10385:d164fb8e2b21 r10385:d164fb8e2b21 r5584:545d748cc681 r8424:8ec8538eb70c r5584:545d748cc681 r5584:545d748cc681 r11725:57bc99fdc1bc r12622:202e83a6cee7 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r18618:99acc2ef1619 r18618:99acc2ef1619 r18618:99acc2ef1619 r18618:99acc2ef1619 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r11725:57bc99fdc1bc r14506:aac88421de94 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 | /* $Id$ */
/*
* This file is part of OpenTTD.
* 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.
* 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.
* 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/>.
*/
/** @file intro_gui.cpp The main menu GUI. */
#include "stdafx.h"
#include "error.h"
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
#include "network/network.h"
#include "genworld.h"
#include "network/network_gui.h"
#include "network/network_content.h"
#include "landscape_type.h"
#include "strings_func.h"
#include "fios.h"
#include "ai/ai_gui.hpp"
#include "gfx_func.h"
#include "core/geometry_func.hpp"
#include "language.h"
#include "rev.h"
#include "highscore.h"
#include "widgets/intro_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "safeguards.h"
struct SelectGameWindow : public Window {
SelectGameWindow(WindowDesc *desc) : Window(desc)
{
this->CreateNestedTree();
this->FinishInitNested(0);
this->OnInvalidateData();
}
/**
* Some data on this window has become invalid.
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{
if (!gui_scope) return;
this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(WID_SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC);
this->SetWidgetLoweredState(WID_SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC);
this->SetWidgetLoweredState(WID_SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND);
}
virtual void OnInit()
{
bool missing_sprites = _missing_extra_graphics > 0 && !IsReleasedVersion();
this->GetWidget<NWidgetStacked>(WID_SGI_BASESET_SELECTION)->SetDisplayedPlane(missing_sprites ? 0 : SZSP_NONE);
bool missing_lang = _current_language->missing >= _settings_client.gui.missing_strings_threshold && !IsReleasedVersion();
this->GetWidget<NWidgetStacked>(WID_SGI_TRANSLATION_SELECTION)->SetDisplayedPlane(missing_lang ? 0 : SZSP_NONE);
}
virtual void DrawWidget(const Rect &r, int widget) const
{
switch (widget) {
case WID_SGI_BASESET:
SetDParam(0, _missing_extra_graphics);
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_BASESET, TC_FROMSTRING, SA_CENTER);
break;
case WID_SGI_TRANSLATION:
SetDParam(0, _current_language->missing);
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_INTRO_TRANSLATION, TC_FROMSTRING, SA_CENTER);
break;
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
StringID str = 0;
switch (widget) {
case WID_SGI_BASESET:
SetDParam(0, _missing_extra_graphics);
str = STR_INTRO_BASESET;
break;
case WID_SGI_TRANSLATION:
SetDParam(0, _current_language->missing);
str = STR_INTRO_TRANSLATION;
break;
}
if (str != 0) {
int height = GetStringHeight(str, size->width);
if (height > 3 * FONT_HEIGHT_NORMAL) {
/* Don't let the window become too high. */
Dimension textdim = GetStringBoundingBox(str);
textdim.height *= 3;
textdim.width -= textdim.width / 2;
*size = maxdim(*size, textdim);
} else {
size->height = height + padding.height;
}
}
}
virtual void OnClick(Point pt, int widget, int click_count)
{
#ifdef ENABLE_NETWORK
/* Do not create a network server when you (just) have closed one of the game
* creation/load windows for the network server. */
if (IsInsideMM(widget, WID_SGI_GENERATE_GAME, WID_SGI_EDIT_SCENARIO + 1)) _is_network_server = false;
#endif /* ENABLE_NETWORK */
switch (widget) {
case WID_SGI_GENERATE_GAME:
if (_ctrl_pressed) {
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
} else {
ShowGenerateLandscape();
}
break;
case WID_SGI_LOAD_GAME: ShowSaveLoadDialog(FT_SAVEGAME, SLO_LOAD); break;
case WID_SGI_PLAY_SCENARIO: ShowSaveLoadDialog(FT_SCENARIO, SLO_LOAD); break;
case WID_SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(FT_HEIGHTMAP,SLO_LOAD); break;
case WID_SGI_EDIT_SCENARIO: StartScenarioEditor(); break;
case WID_SGI_PLAY_NETWORK:
if (!_network_available) {
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
ShowNetworkGameWindow();
}
break;
case WID_SGI_TEMPERATE_LANDSCAPE: case WID_SGI_ARCTIC_LANDSCAPE:
case WID_SGI_TROPIC_LANDSCAPE: case WID_SGI_TOYLAND_LANDSCAPE:
SetNewLandscapeType(widget - WID_SGI_TEMPERATE_LANDSCAPE);
break;
case WID_SGI_OPTIONS: ShowGameOptions(); break;
case WID_SGI_HIGHSCORE: ShowHighscoreTable(); break;
case WID_SGI_SETTINGS_OPTIONS:ShowGameSettings(); break;
case WID_SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
case WID_SGI_CONTENT_DOWNLOAD:
if (!_network_available) {
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else {
ShowNetworkContentListWindow();
}
break;
case WID_SGI_AI_SETTINGS: ShowAIConfigWindow(); break;
case WID_SGI_EXIT: HandleExitGameRequest(); break;
}
}
};
static const NWidgetPart _nested_select_game_widgets[] = {
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_INTRO_CAPTION, STR_NULL),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
/* 'generate game' and 'load game' buttons */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_GENERATE_GAME), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_NEW_GAME, STR_INTRO_TOOLTIP_NEW_GAME), SetPadding(0, 0, 0, 10), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_LOAD_GAME), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_LOAD_GAME, STR_INTRO_TOOLTIP_LOAD_GAME), SetPadding(0, 10, 0, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 6),
/* 'play scenario' and 'play heightmap' buttons */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_SCENARIO), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_PLAY_SCENARIO, STR_INTRO_TOOLTIP_PLAY_SCENARIO), SetPadding(0, 0, 0, 10), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_HEIGHTMAP), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_PLAY_HEIGHTMAP, STR_INTRO_TOOLTIP_PLAY_HEIGHTMAP), SetPadding(0, 10, 0, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 6),
/* 'edit scenario' and 'play multiplayer' buttons */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_EDIT_SCENARIO), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_SCENARIO_EDITOR, STR_INTRO_TOOLTIP_SCENARIO_EDITOR), SetPadding(0, 0, 0, 10), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_PLAY_NETWORK), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_MULTIPLAYER, STR_INTRO_TOOLTIP_MULTIPLAYER), SetPadding(0, 10, 0, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 7),
/* climate selection buttons */
NWidget(NWID_HORIZONTAL),
NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0),
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TEMPERATE_LANDSCAPE), SetMinimalSize(77, 55),
SetDataTip(SPR_SELECT_TEMPERATE, STR_INTRO_TOOLTIP_TEMPERATE),
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_ARCTIC_LANDSCAPE), SetMinimalSize(77, 55),
SetDataTip(SPR_SELECT_SUB_ARCTIC, STR_INTRO_TOOLTIP_SUB_ARCTIC_LANDSCAPE),
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TROPIC_LANDSCAPE), SetMinimalSize(77, 55),
SetDataTip(SPR_SELECT_SUB_TROPICAL, STR_INTRO_TOOLTIP_SUB_TROPICAL_LANDSCAPE),
NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetFill(1, 0),
NWidget(WWT_IMGBTN_2, COLOUR_ORANGE, WID_SGI_TOYLAND_LANDSCAPE), SetMinimalSize(77, 55),
SetDataTip(SPR_SELECT_TOYLAND, STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE),
NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 7),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_BASESET_SELECTION),
NWidget(NWID_VERTICAL),
NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_BASESET), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10),
EndContainer(),
EndContainer(),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SGI_TRANSLATION_SELECTION),
NWidget(NWID_VERTICAL),
NWidget(WWT_EMPTY, COLOUR_ORANGE, WID_SGI_TRANSLATION), SetMinimalSize(316, 12), SetFill(1, 0), SetPadding(0, 10, 7, 10),
EndContainer(),
EndContainer(),
/* 'game options' and 'advanced settings' buttons */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_OPTIONS), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_GAME_OPTIONS, STR_INTRO_TOOLTIP_GAME_OPTIONS), SetPadding(0, 0, 0, 10), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_SETTINGS_OPTIONS), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_CONFIG_SETTINGS_TREE, STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE), SetPadding(0, 10, 0, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 6),
/* 'script settings' and 'newgrf settings' buttons */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_AI_SETTINGS), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_SCRIPT_SETTINGS, STR_INTRO_TOOLTIP_SCRIPT_SETTINGS), SetPadding(0, 0, 0, 10), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_GRF_SETTINGS), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_INTRO_TOOLTIP_NEWGRF_SETTINGS), SetPadding(0, 10, 0, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 6),
/* 'online content' and 'highscore' buttons */
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_CONTENT_DOWNLOAD), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT), SetPadding(0, 0, 0, 10), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_HIGHSCORE), SetMinimalSize(158, 12),
SetDataTip(STR_INTRO_HIGHSCORE, STR_INTRO_TOOLTIP_HIGHSCORE), SetPadding(0, 10, 0, 0), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 6),
/* 'exit program' button */
NWidget(NWID_HORIZONTAL),
NWidget(NWID_SPACER), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_ORANGE, WID_SGI_EXIT), SetMinimalSize(128, 12),
SetDataTip(STR_INTRO_QUIT, STR_INTRO_TOOLTIP_QUIT),
NWidget(NWID_SPACER), SetFill(1, 0),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
EndContainer(),
};
static WindowDesc _select_game_desc(
WDP_CENTER, NULL, 0, 0,
WC_SELECT_GAME, WC_NONE,
0,
_nested_select_game_widgets, lengthof(_nested_select_game_widgets)
);
void ShowSelectGameWindow()
{
new SelectGameWindow(&_select_game_desc);
}
static void AskExitGameCallback(Window *w, bool confirmed)
{
if (confirmed) _exit_game = true;
}
void AskExitGame()
{
#if defined(_WIN32)
SetDParam(0, STR_OSNAME_WINDOWS);
#elif defined(__APPLE__)
SetDParam(0, STR_OSNAME_OSX);
#elif defined(__BEOS__)
SetDParam(0, STR_OSNAME_BEOS);
#elif defined(__HAIKU__)
SetDParam(0, STR_OSNAME_HAIKU);
#elif defined(__MORPHOS__)
SetDParam(0, STR_OSNAME_MORPHOS);
#elif defined(__AMIGA__)
SetDParam(0, STR_OSNAME_AMIGAOS);
#elif defined(__OS2__)
SetDParam(0, STR_OSNAME_OS2);
#elif defined(SUNOS)
SetDParam(0, STR_OSNAME_SUNOS);
#elif defined(DOS)
SetDParam(0, STR_OSNAME_DOS);
#else
SetDParam(0, STR_OSNAME_UNIX);
#endif
ShowQuery(
STR_QUIT_CAPTION,
STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD,
NULL,
AskExitGameCallback
);
}
static void AskExitToGameMenuCallback(Window *w, bool confirmed)
{
if (confirmed) {
_switch_mode = SM_MENU;
ClearErrorMessages();
}
}
void AskExitToGameMenu()
{
ShowQuery(
STR_ABANDON_GAME_CAPTION,
(_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_ABANDON_SCENARIO_QUERY,
NULL,
AskExitToGameMenuCallback
);
}
|