Files
@ r11410:4f1c35306fab
Branch filter:
Location: cpp/openttd-patchpack/source/src/intro_gui.cpp - annotation
r11410:4f1c35306fab
7.5 KiB
text/x-c
(svn r15772) -Fix (r15767): MSVC can't find the right function anymore because the return value in the header was not updated.
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 | r5584:545d748cc681 r5584:545d748cc681 r9111:983de9c5a848 r6201:2e76eb9a1d7a r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r8107:82461791b7a2 r8107:82461791b7a2 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r10793:5ba2151e71e9 r10960:e97ebf9cf99b r8114:866ed489ed98 r8131:7a50db7be0ff r8149:8a97dd280f35 r8270:c2ec53375c9d r9117:e2b5a638a7c1 r10960:e97ebf9cf99b r10840:7a608f4ad153 r11335:c7c33f62d918 r5584:545d748cc681 r8264:d493cb51fe8a r8264:d493cb51fe8a r8264:d493cb51fe8a r5584:545d748cc681 r10793:5ba2151e71e9 r10840:7a608f4ad153 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r5584:545d748cc681 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r5584:545d748cc681 r9745:cf2338c8f415 r9745:cf2338c8f415 r11069:3f09c162966b r11127:bb0b63f7fc8b r5584:545d748cc681 r10793:5ba2151e71e9 r11127:bb0b63f7fc8b r10840:7a608f4ad153 r10840:7a608f4ad153 r10840:7a608f4ad153 r9745:cf2338c8f415 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9358:e56a864fbbb0 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r11069:3f09c162966b r9282:cec57957cd97 r10793:5ba2151e71e9 r10840:7a608f4ad153 r9282:cec57957cd97 r9282:cec57957cd97 r8365:25892c76d49b r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9358:e56a864fbbb0 r9282:cec57957cd97 r9282:cec57957cd97 r5584:545d748cc681 r9282:cec57957cd97 r9282:cec57957cd97 r9358:e56a864fbbb0 r9745:cf2338c8f415 r9745:cf2338c8f415 r9745:cf2338c8f415 r9358:e56a864fbbb0 r9282:cec57957cd97 r9282:cec57957cd97 r5584:545d748cc681 r9282:cec57957cd97 r9282:cec57957cd97 r6898:350481a50abc r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r6898:350481a50abc r6555:9ef973fe9db5 r9282:cec57957cd97 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r11335:c7c33f62d918 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r8365:25892c76d49b r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r9282:cec57957cd97 r8365:25892c76d49b r9282:cec57957cd97 r9282:cec57957cd97 r9358:e56a864fbbb0 r9282:cec57957cd97 r9282:cec57957cd97 r8365:25892c76d49b r9282:cec57957cd97 r9282:cec57957cd97 r11069:3f09c162966b r9282:cec57957cd97 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10793:5ba2151e71e9 r10840:7a608f4ad153 r9282:cec57957cd97 r9282:cec57957cd97 r5584:545d748cc681 r9282:cec57957cd97 r5584:545d748cc681 r11368:058349c3a02c r10840:7a608f4ad153 r5893:6c4fd9987e0f r5584:545d748cc681 r11368:058349c3a02c 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 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 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r6247:96e840dbefcc r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 r5584:545d748cc681 | /* $Id$ */
/** @file intro_gui.cpp The main menu GUI. */
#include "stdafx.h"
#include "openttd.h"
#include "gui.h"
#include "window_gui.h"
#include "textbuf_gui.h"
#include "network/network.h"
#include "variables.h"
#include "genworld.h"
#include "network/network_gui.h"
#include "network/network_content.h"
#include "landscape_type.h"
#include "strings_func.h"
#include "window_func.h"
#include "fios.h"
#include "settings_type.h"
#include "functions.h"
#include "newgrf_config.h"
#include "ai/ai_gui.hpp"
#include "gfx_func.h"
#include "table/strings.h"
#include "table/sprites.h"
static const Widget _select_game_widgets[] = {
{ WWT_CAPTION, RESIZE_NONE, COLOUR_BROWN, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},
{ WWT_PANEL, RESIZE_NONE, COLOUR_BROWN, 0, 335, 14, 212, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 10, 167, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 168, 325, 40, 51, STR_PLAY_HEIGHTMAP, STR_PLAY_HEIGHTMAP_HINT},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 10, 167, 58, 69, STR_SCENARIO_EDITOR, STR_02FE_CREATE_A_CUSTOMIZED_GAME},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 168, 325, 58, 69, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME},
{ WWT_IMGBTN_2, RESIZE_NONE, COLOUR_ORANGE, 10, 86, 77, 131, SPR_SELECT_TEMPERATE, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
{ WWT_IMGBTN_2, RESIZE_NONE, COLOUR_ORANGE, 90, 166, 77, 131, SPR_SELECT_SUB_ARCTIC, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
{ WWT_IMGBTN_2, RESIZE_NONE, COLOUR_ORANGE, 170, 246, 77, 131, SPR_SELECT_SUB_TROPICAL, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
{ WWT_IMGBTN_2, RESIZE_NONE, COLOUR_ORANGE, 250, 326, 77, 131, SPR_SELECT_TOYLAND, STR_0311_SELECT_TOYLAND_LANDSCAPE},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 10, 167, 139, 150, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 168, 325, 139, 150, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 10, 167, 157, 168, STR_CONFIG_SETTING, STR_CONFIG_SETTING_TIP},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 168, 325, 157, 168, STR_NEWGRF_SETTINGS_BUTTON, STR_NEWGRF_SETTINGS_BUTTON_TIP},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 10, 167, 175, 186, STR_CONTENT_INTRO_BUTTON, STR_CONTENT_INTRO_BUTTON_TIP},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 168, 325, 175, 186, STR_AI_SETTINGS_BUTTON, STR_AI_SETTINGS_BUTTON_TIP},
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_ORANGE, 104, 231, 193, 204, STR_0304_QUIT, STR_0305_QUIT_OPENTTD},
{ WIDGETS_END},
};
static inline void SetNewLandscapeType(byte landscape)
{
_settings_newgame.game_creation.landscape = landscape;
InvalidateWindowClasses(WC_SELECT_GAME);
}
struct SelectGameWindow : public Window {
private:
enum SelectGameIntroWidgets {
SGI_GENERATE_GAME = 2,
SGI_LOAD_GAME,
SGI_PLAY_SCENARIO,
SGI_PLAY_HEIGHTMAP,
SGI_EDIT_SCENARIO,
SGI_PLAY_NETWORK,
SGI_TEMPERATE_LANDSCAPE,
SGI_ARCTIC_LANDSCAPE,
SGI_TROPIC_LANDSCAPE,
SGI_TOYLAND_LANDSCAPE,
SGI_OPTIONS,
SGI_DIFFICULTIES,
SGI_SETTINGS_OPTIONS,
SGI_GRF_SETTINGS,
SGI_CONTENT_DOWNLOAD,
SGI_AI_SETTINGS,
SGI_EXIT,
};
public:
SelectGameWindow(const WindowDesc *desc) : Window(desc)
{
this->LowerWidget(_settings_newgame.game_creation.landscape + SGI_TEMPERATE_LANDSCAPE);
this->FindWindowPlacementAndResize(desc);
}
virtual void OnPaint()
{
this->SetWidgetLoweredState(SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(SGI_ARCTIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_ARCTIC);
this->SetWidgetLoweredState(SGI_TROPIC_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TROPIC);
this->SetWidgetLoweredState(SGI_TOYLAND_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TOYLAND);
SetDParam(0, STR_6801_EASY + _settings_newgame.difficulty.diff_level);
this->DrawWidgets();
}
virtual void OnClick(Point pt, int widget)
{
#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, SGI_GENERATE_GAME, SGI_EDIT_SCENARIO + 1)) _is_network_server = false;
#endif /* ENABLE_NETWORK */
switch (widget) {
case SGI_GENERATE_GAME:
if (_ctrl_pressed) {
StartNewGameWithoutGUI(GENERATE_NEW_SEED);
} else {
ShowGenerateLandscape();
}
break;
case SGI_LOAD_GAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
case SGI_PLAY_SCENARIO: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
case SGI_PLAY_HEIGHTMAP: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break;
case SGI_EDIT_SCENARIO: StartScenarioEditor(); break;
case SGI_PLAY_NETWORK:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
} else {
ShowNetworkGameWindow();
}
break;
case SGI_TEMPERATE_LANDSCAPE: case SGI_ARCTIC_LANDSCAPE:
case SGI_TROPIC_LANDSCAPE: case SGI_TOYLAND_LANDSCAPE:
this->RaiseWidget(_settings_newgame.game_creation.landscape + SGI_TEMPERATE_LANDSCAPE);
SetNewLandscapeType(widget - SGI_TEMPERATE_LANDSCAPE);
break;
case SGI_OPTIONS: ShowGameOptions(); break;
case SGI_DIFFICULTIES: ShowGameDifficulty(); break;
case SGI_SETTINGS_OPTIONS:ShowGameSettings(); break;
case SGI_GRF_SETTINGS: ShowNewGRFSettings(true, true, false, &_grfconfig_newgame); break;
case SGI_CONTENT_DOWNLOAD:
if (!_network_available) {
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
} else {
ShowNetworkContentListWindow();
}
break;
case SGI_AI_SETTINGS: ShowAIConfigWindow(); break;
case SGI_EXIT: HandleExitGameRequest(); break;
}
}
};
static const WindowDesc _select_game_desc(
WDP_CENTER, WDP_CENTER, 336, 213, 336, 213,
WC_SELECT_GAME, WC_NONE,
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
_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(__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_00C7_QUIT,
STR_00CA_ARE_YOU_SURE_YOU_WANT_TO,
NULL,
AskExitGameCallback
);
}
static void AskExitToGameMenuCallback(Window *w, bool confirmed)
{
if (confirmed) _switch_mode = SM_MENU;
}
void AskExitToGameMenu()
{
ShowQuery(
STR_0161_QUIT_GAME,
(_game_mode != GM_EDITOR) ? STR_ABANDON_GAME_QUERY : STR_QUIT_SCENARIO_QUERY,
NULL,
AskExitToGameMenuCallback
);
}
|