intro_gui.c
author tron
Sun, 21 May 2006 13:51:36 +0000
changeset 3884 793081f80381
parent 3207 231948813b05
child 3888 3cbfc7edbc2b
permissions -rw-r--r--
(svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1796
diff changeset
     4
#include "openttd.h"
507
04b5403aaf6b (svn r815) Include strings.h only in the files which need it.
tron
parents: 206
diff changeset
     5
#include "table/strings.h"
2163
b17b313113a0 (svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents: 2159
diff changeset
     6
#include "functions.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
#include "window.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
#include "gui.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
#include "gfx.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
#include "player.h"
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    11
#include "network.h"
2159
f6284cf5fab0 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 1891
diff changeset
    12
#include "variables.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    14
extern void SwitchMode(int new_mode);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
static const Widget _select_game_widgets[] = {
1618
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
    17
{    WWT_CAPTION, RESIZE_NONE, 13,   0, 335,   0,  13, STR_0307_OPENTTD,       STR_NULL},
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    18
{     WWT_IMGBTN, RESIZE_NONE, 13,   0, 335,  14, 196, STR_NULL,               STR_NULL},
1618
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
    19
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12,  10, 167,  22,  33, STR_0140_NEW_GAME,      STR_02FB_START_A_NEW_GAME},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
    20
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325,  22,  33, STR_0141_LOAD_GAME,     STR_02FC_LOAD_A_SAVED_GAME},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
    21
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12,  10, 167,  40,  51, STR_0220_CREATE_SCENARIO,STR_02FE_CREATE_A_CUSTOMIZED_GAME},
1619
11108fa4b24d (svn r2123) Reordered _select_game_widets[] to follow a sensible order.
pasky
parents: 1618
diff changeset
    22
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325,  40,  51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING},
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    23
{    WWT_PANEL_2, RESIZE_NONE, 12,  10,  86,  59, 113, 0x1312,                 STR_030E_SELECT_TEMPERATE_LANDSCAPE},
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    24
{    WWT_PANEL_2, RESIZE_NONE, 12,  90, 166,  59, 113, 0x1314,                 STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    25
{    WWT_PANEL_2, RESIZE_NONE, 12, 170, 246,  59, 113, 0x1316,                 STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    26
{    WWT_PANEL_2, RESIZE_NONE, 12, 250, 326,  59, 113, 0x1318,                 STR_0311_SELECT_TOYLAND_LANDSCAPE},
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    27
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    28
{      WWT_PANEL, RESIZE_NONE, 12, 219, 254, 120, 131, STR_NULL,               STR_NULL},
2725
775e3e14ca46 (svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents: 2639
diff changeset
    29
{    WWT_TEXTBTN, RESIZE_NONE, 12, 255, 266, 120, 131, STR_0225,               STR_NULL},
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    30
{      WWT_PANEL, RESIZE_NONE, 12, 279, 314, 120, 131, STR_NULL,               STR_NULL},
2725
775e3e14ca46 (svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents: 2639
diff changeset
    31
{    WWT_TEXTBTN, RESIZE_NONE, 12, 315, 326, 120, 131, STR_0225,               STR_NULL},
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    32
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    33
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12,  10, 167, 138, 149, STR_SINGLE_PLAYER,      STR_02FF_SELECT_SINGLE_PLAYER_GAME},
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    34
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 138, 149, STR_MULTIPLAYER,        STR_0300_SELECT_MULTIPLAYER_GAME},
1625
c2849df304da (svn r2129) Reverted r2125 and depending revisions (map size selector in the intro window). Will be done in a separate dialog. This also fixes showing of various rail/road-related strings.
pasky
parents: 1624
diff changeset
    35
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12,  10, 167, 159, 170, STR_0148_GAME_OPTIONS,  STR_0301_DISPLAY_GAME_OPTIONS},
c2849df304da (svn r2129) Reverted r2125 and depending revisions (map size selector in the intro window). Will be done in a separate dialog. This also fixes showing of various rail/road-related strings.
pasky
parents: 1624
diff changeset
    36
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 159, 170, STR_01FE_DIFFICULTY,    STR_0302_DISPLAY_DIFFICULTY_OPTIONS},
c2849df304da (svn r2129) Reverted r2125 and depending revisions (map size selector in the intro window). Will be done in a separate dialog. This also fixes showing of various rail/road-related strings.
pasky
parents: 1624
diff changeset
    37
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12,  10, 167, 177, 188, STR_CONFIG_PATCHES,     STR_CONFIG_PATCHES_TIP},
c2849df304da (svn r2129) Reverted r2125 and depending revisions (map size selector in the intro window). Will be done in a separate dialog. This also fixes showing of various rail/road-related strings.
pasky
parents: 1624
diff changeset
    38
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 177, 188, STR_0304_QUIT,          STR_0305_QUIT_OPENTTD},
1618
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
    39
{    WIDGETS_END },
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    42
extern void HandleOnEditText(WindowEvent *e);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
    43
extern void HandleOnEditTextCancel(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    44
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    45
static inline void CreateScenario(void) {_switch_mode = SM_EDITOR;}
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    46
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    47
static inline void SetNewLandscapeType(byte landscape)
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    48
{
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    49
	_opt_newgame.landscape = landscape;
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    50
	InvalidateWindowClasses(WC_SELECT_GAME);
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    51
}
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    52
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    53
static void SelectGameWndProc(Window *w, WindowEvent *e)
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    54
{
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    55
	/* We do +/- 6 for the map_xy because 64 is 2^6, but it is the lowest available element */
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    56
	static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID};
3207
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
    57
	extern Patches _patches_newgame;
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    58
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    59
	switch (e->event) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	case WE_PAINT:
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    61
		w->click_state = (w->click_state & ~(1 << 14) & ~(0xF << 6)) | (1 << (_opt_newgame.landscape + 6)) | (1 << 14);
1500
a66721629bc0 (svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents: 1390
diff changeset
    62
		SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
		DrawWindowWidgets(w);
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    64
1717
44bff152f15f (svn r2221) - Fix: "Map size" is two words. Also draw the string right-aligned in the intro gui so it doesn't matter how long it is in other languages.
Darkvater
parents: 1711
diff changeset
    65
		DrawStringRightAligned(216, 121, STR_MAPSIZE, 0);
3207
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
    66
		DrawString(223, 121, mapsizes[_patches_newgame.map_x - 6], 0x10);
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    67
		DrawString(270, 121, STR_BY, 0);
3207
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
    68
		DrawString(283, 121, mapsizes[_patches_newgame.map_y - 6], 0x10);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
	case WE_CLICK:
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    72
		switch (e->click.widget) {
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    73
		case 2: AskForNewGameToStart(); break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
		case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    75
		case 4: CreateScenario(); break;
1619
11108fa4b24d (svn r2123) Reordered _select_game_widets[] to follow a sensible order.
pasky
parents: 1618
diff changeset
    76
		case 5: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
1620
a8b502e4b25f (svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents: 1619
diff changeset
    77
		case 6: case 7: case 8: case 9:
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
    78
			SetNewLandscapeType(e->click.widget - 6);
1620
a8b502e4b25f (svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents: 1619
diff changeset
    79
			break;
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    80
		case 10: case 11: /* Mapsize X */
3207
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
    81
			ShowDropDownMenu(w, mapsizes, _patches_newgame.map_x - 6, 11, 0, 0);
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    82
			break;
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    83
		case 12: case 13: /* Mapsize Y */
3207
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
    84
			ShowDropDownMenu(w, mapsizes, _patches_newgame.map_y - 6, 13, 0, 0);
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    85
			break;
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    86
		case 15:
1620
a8b502e4b25f (svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents: 1619
diff changeset
    87
#ifdef ENABLE_NETWORK
105
44e894da0fef (svn r106) New network core (by sign_de)
dominik
parents: 74
diff changeset
    88
			if (!_network_available) {
2749
c9312a4a1efe (svn r3294) - Fix: use INVALID_STRING_ID instead of -1.
Darkvater
parents: 2725
diff changeset
    89
				ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
774
bb9ec520a1b1 (svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents: 770
diff changeset
    90
			} else
172
8d8b3383470d (svn r173) -Network: [1023231] Debug Code + ErrorBoxes + Load Game/Scenario. Added some more desync debug code and replaced some of the error() calls with some better error boxes. Hopefully find desyncs easier (sign_de)
darkvater
parents: 161
diff changeset
    91
				ShowNetworkGameWindow();
1620
a8b502e4b25f (svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents: 1619
diff changeset
    92
#else
2749
c9312a4a1efe (svn r3294) - Fix: use INVALID_STRING_ID instead of -1.
Darkvater
parents: 2725
diff changeset
    93
			ShowErrorMessage(INVALID_STRING_ID ,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
1620
a8b502e4b25f (svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents: 1619
diff changeset
    94
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    95
			break;
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    96
		case 16: ShowGameOptions(); break;
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    97
		case 17: ShowGameDifficulty(); break;
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    98
		case 18: ShowPatchesSelection(); break;
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
    99
		case 19: AskExitGame(); break;
129
df1a60bc0d70 (svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents: 126
diff changeset
   100
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   101
		break;
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   102
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   103
	case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   104
	case WE_ON_EDIT_TEXT_CANCEL: HandleOnEditTextCancel(); break;
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
   105
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
   106
	case WE_DROPDOWN_SELECT: /* Mapsize selection */
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
   107
		switch (e->dropdown.button) {
3207
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
   108
			/* We need a *hacky* here because generateworld is called with _patches
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
   109
			 * but it only gets the new value INSIDE generateworld so not setting it would
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
   110
			 * break generating a new game on the run (eg MP) */
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
   111
			case 11: _patches.map_x = _patches_newgame.map_x = e->dropdown.index + 6; break;
231948813b05 (svn r3875) - [Patches] Fix up the intro menu so the right values for the mapsize are shown (the default ones). Setting the value involves a small hack in that we also set the _patches value because that is used for world-generation and only inside there do the values get copied from _newgame
Darkvater
parents: 2791
diff changeset
   112
			case 13: _patches.map_y = _patches_newgame.map_y = e->dropdown.index + 6; break;
1711
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
   113
		}
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
   114
		SetWindowDirty(w);
1365fd255634 (svn r2215) - Feature: Add a temporary mapsize selector to the intro gui. This is sufficient until the real window is designed & coded.
Darkvater
parents: 1625
diff changeset
   115
		break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
	}
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   117
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
static const WindowDesc _select_game_desc = {
1625
c2849df304da (svn r2129) Reverted r2125 and depending revisions (map size selector in the intro window). Will be done in a separate dialog. This also fixes showing of various rail/road-related strings.
pasky
parents: 1624
diff changeset
   121
	WDP_CENTER, WDP_CENTER, 336, 197,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   122
	WC_SELECT_GAME,0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   124
	_select_game_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
	SelectGameWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   126
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   127
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   128
void ShowSelectGameWindow(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
	AllocateWindowDesc(&_select_game_desc);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
   133
void GenRandomNewGame(uint32 rnd1, uint32 rnd2)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
{
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
   135
	_random_seeds[0][0] = rnd1;
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1728
diff changeset
   136
	_random_seeds[0][1] = rnd2;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   138
	SwitchMode(SM_NEWGAME);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1794
diff changeset
   141
void StartScenarioEditor(uint32 rnd1, uint32 rnd2)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
{
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1794
diff changeset
   143
	_random_seeds[0][0] = rnd1;
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1794
diff changeset
   144
	_random_seeds[0][1] = rnd2;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   146
	SwitchMode(SM_START_SCENARIO);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
static const Widget _ask_abandon_game_widgets[] = {
2725
775e3e14ca46 (svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents: 2639
diff changeset
   150
{ WWT_CLOSEBOX, RESIZE_NONE,  4,   0,  10,   0,  13, STR_00C5,      STR_018B_CLOSE_WINDOW},
1618
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   151
{  WWT_CAPTION, RESIZE_NONE,  4,  11, 179,   0,  13, STR_00C7_QUIT, STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   152
{   WWT_IMGBTN, RESIZE_NONE,  4,   0, 179,  14,  91, 0x0,           STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   153
{  WWT_TEXTBTN, RESIZE_NONE, 12,  25,  84,  72,  83, STR_00C9_NO,   STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   154
{  WWT_TEXTBTN, RESIZE_NONE, 12,  95, 154,  72,  83, STR_00C8_YES,  STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   155
{  WIDGETS_END },
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   158
static void AskAbandonGameWndProc(Window* w, WindowEvent* e)
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   159
{
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   160
	switch (e->event) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
	case WE_PAINT:
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
		DrawWindowWidgets(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
#if defined(_WIN32)
534
306bc86eb23e (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   164
		SetDParam(0, STR_0133_WINDOWS);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
#elif defined(__APPLE__)
534
306bc86eb23e (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   166
		SetDParam(0, STR_0135_OSX);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
#elif defined(__BEOS__)
534
306bc86eb23e (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   168
		SetDParam(0, STR_OSNAME_BEOS);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
#elif defined(__MORPHOS__)
534
306bc86eb23e (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   170
		SetDParam(0, STR_OSNAME_MORPHOS);
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 810
diff changeset
   171
#elif defined(__AMIGA__)
587
ea2a8bd38f41 (svn r1007) Remove the last SET_DPARAM (:
tron
parents: 569
diff changeset
   172
		SetDParam(0, STR_OSNAME_AMIGAOS);
810
a1494b19bd2a (svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents: 774
diff changeset
   173
#elif defined(__OS2__)
a1494b19bd2a (svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents: 774
diff changeset
   174
		SetDParam(0, STR_OSNAME_OS2);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
#else
534
306bc86eb23e (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   176
		SetDParam(0, STR_0134_UNIX);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
#endif
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   178
		DrawStringMultiCenter(90, 38, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
		return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
	case WE_CLICK:
2631
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   182
		switch (e->click.widget) {
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   183
			case 3: DeleteWindow(w);   break;
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   184
			case 4: _exit_game = true; break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
		break;
2631
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   187
161
74453c59315c (svn r162) -Feature: when exit game window pops up, 'Enter' quits the game
darkvater
parents: 129
diff changeset
   188
	case WE_KEYPRESS: /* Exit game on pressing 'Enter' */
2631
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   189
		switch (e->keypress.keycode) {
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   190
			case WKC_RETURN:
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   191
			case WKC_NUM_ENTER:
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   192
				_exit_game = true;
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   193
				break;
2ed0eb408229 (svn r3173) Use the trinary operator and switch to improve readability
tron
parents: 2204
diff changeset
   194
		}
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   195
		break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
static const WindowDesc _ask_abandon_game_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
	WDP_CENTER, WDP_CENTER, 180, 92,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   201
	WC_ASK_ABANDON_GAME,0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
	_ask_abandon_game_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
	AskAbandonGameWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   205
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   207
void AskExitGame(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   208
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   209
	AllocateWindowDescFront(&_ask_abandon_game_desc, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
static const Widget _ask_quit_game_widgets[] = {
2725
775e3e14ca46 (svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents: 2639
diff changeset
   214
{ WWT_CLOSEBOX, RESIZE_NONE,  4,   0,  10,   0,  13, STR_00C5,           STR_018B_CLOSE_WINDOW},
1618
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   215
{  WWT_CAPTION, RESIZE_NONE,  4,  11, 179,   0,  13, STR_0161_QUIT_GAME, STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   216
{   WWT_IMGBTN, RESIZE_NONE,  4,   0, 179,  14,  91, 0x0,                STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   217
{  WWT_TEXTBTN, RESIZE_NONE, 12,  25,  84,  72,  83, STR_00C9_NO,        STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   218
{  WWT_TEXTBTN, RESIZE_NONE, 12,  95, 154,  72,  83, STR_00C8_YES,       STR_NULL},
70408b5c4e28 (svn r2122) Reformatted the widget tables so that they don't look so ugly anymore, especially with different tab widths than 2.
pasky
parents: 1500
diff changeset
   219
{  WIDGETS_END },
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   220
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   222
static void AskQuitGameWndProc(Window* w, WindowEvent* e)
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   223
{
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   224
	switch (e->event) {
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   225
		case WE_PAINT:
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   226
			DrawWindowWidgets(w);
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   227
			DrawStringMultiCenter(
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   228
				90, 38,
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   229
				_game_mode != GM_EDITOR ?
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   230
					STR_0160_ARE_YOU_SURE_YOU_WANT_TO : STR_029B_ARE_YOU_SURE_YOU_WANT_TO,
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   231
				178
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   232
			);
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   233
			break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   235
		case WE_CLICK:
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   236
			switch (e->click.widget) {
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   237
				case 3: DeleteWindow(w);        break;
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   238
				case 4: _switch_mode = SM_MENU; break;
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   239
			}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   240
			break;
661
0d0a151aa4cd (svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents: 654
diff changeset
   241
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   242
		case WE_KEYPRESS: /* Return to main menu on pressing 'Enter' */
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   243
			if (e->keypress.keycode == WKC_RETURN) _switch_mode = SM_MENU;
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2631
diff changeset
   244
			break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   245
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   247
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
static const WindowDesc _ask_quit_game_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   249
	WDP_CENTER, WDP_CENTER, 180, 92,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
	WC_QUIT_GAME,0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
	_ask_quit_game_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
	AskQuitGameWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   254
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   255
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   257
void AskExitToGameMenu(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   258
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
	AllocateWindowDescFront(&_ask_quit_game_desc, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   260
}