author | glx |
Wed, 04 Oct 2006 00:27:31 +0000 | |
changeset 4721 | 4dc4983c08fa |
parent 4719 | fc6e14219f72 |
child 4727 | 6819acce7c57 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 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 | 7 |
#include "window.h" |
8 |
#include "gui.h" |
|
9 |
#include "gfx.h" |
|
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" |
3888
3cbfc7edbc2b
(svn r4944) Codechange: make _patches_newgame available via settings.h and remove instances of extern Patches _patches_newgame in .c files
rubidium
parents:
3207
diff
changeset
|
13 |
#include "settings.h" |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
14 |
#include "heightmap.h" |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
15 |
#include "genworld.h" |
0 | 16 |
|
17 |
static const Widget _select_game_widgets[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
18 |
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
19 |
{ WWT_IMGBTN, RESIZE_NONE, 13, 0, 335, 14, 176, STR_NULL, STR_NULL}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
20 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
21 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
22 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
23 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 40, 51, STR_PLAY_HEIGHTMAP, STR_PLAY_HEIGHTMAP_HINT}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
24 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 58, 69, STR_0220_CREATE_SCENARIO, STR_02FE_CREATE_A_CUSTOMIZED_GAME}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
25 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 58, 69, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME}, |
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
|
26 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
27 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 10, 86, 77, 131, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
28 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 90, 166, 77, 131, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
29 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 170, 246, 77, 131, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
30 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 250, 326, 77, 131, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE}, |
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
|
31 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
32 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 139, 150, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
33 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 139, 150, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
34 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 157, 168, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP}, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4308
diff
changeset
|
35 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 157, 168, 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
|
36 |
{ WIDGETS_END }, |
0 | 37 |
}; |
38 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
39 |
extern void HandleOnEditText(WindowEvent *e); |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
40 |
|
1794
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
41 |
static inline void SetNewLandscapeType(byte landscape) |
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
42 |
{ |
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
43 |
_opt_newgame.landscape = landscape; |
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
44 |
InvalidateWindowClasses(WC_SELECT_GAME); |
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
45 |
} |
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1728
diff
changeset
|
46 |
|
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
|
47 |
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
|
48 |
{ |
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
|
49 |
switch (e->event) { |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4634
diff
changeset
|
50 |
case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 8); break; |
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4634
diff
changeset
|
51 |
|
0 | 52 |
case WE_PAINT: |
4721
4dc4983c08fa
(svn r6633) -Fix r6631: climate selector now shows the current selected climate (and only this one)
glx
parents:
4719
diff
changeset
|
53 |
SetWidgetLoweredState(w, 8, _opt_newgame.landscape == LT_NORMAL); |
4dc4983c08fa
(svn r6633) -Fix r6631: climate selector now shows the current selected climate (and only this one)
glx
parents:
4719
diff
changeset
|
54 |
SetWidgetLoweredState(w, 9, _opt_newgame.landscape == LT_HILLY); |
4dc4983c08fa
(svn r6633) -Fix r6631: climate selector now shows the current selected climate (and only this one)
glx
parents:
4719
diff
changeset
|
55 |
SetWidgetLoweredState(w, 10, _opt_newgame.landscape == LT_DESERT); |
4dc4983c08fa
(svn r6633) -Fix r6631: climate selector now shows the current selected climate (and only this one)
glx
parents:
4719
diff
changeset
|
56 |
SetWidgetLoweredState(w, 11, _opt_newgame.landscape == LT_CANDY); |
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1390
diff
changeset
|
57 |
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level); |
0 | 58 |
DrawWindowWidgets(w); |
59 |
break; |
|
60 |
||
61 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
62 |
switch (e->we.click.widget) { |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
63 |
case 2: ShowGenerateLandscape(); break; |
0 | 64 |
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
65 |
case 4: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
66 |
case 5: ShowSaveLoadDialog(SLD_LOAD_HEIGHTMAP); break; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
67 |
case 6: ShowCreateScenario(); break; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
68 |
case 7: |
1620
a8b502e4b25f
(svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents:
1619
diff
changeset
|
69 |
#ifdef ENABLE_NETWORK |
105 | 70 |
if (!_network_available) { |
2749
c9312a4a1efe
(svn r3294) - Fix: use INVALID_STRING_ID instead of -1.
Darkvater
parents:
2725
diff
changeset
|
71 |
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3888
diff
changeset
|
72 |
} 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
|
73 |
ShowNetworkGameWindow(); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3888
diff
changeset
|
74 |
} |
1620
a8b502e4b25f
(svn r2124) Final _select_game_widgets[] reordering, even landscape panels in place now.
pasky
parents:
1619
diff
changeset
|
75 |
#else |
2749
c9312a4a1efe
(svn r3294) - Fix: use INVALID_STRING_ID instead of -1.
Darkvater
parents:
2725
diff
changeset
|
76 |
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
|
77 |
#endif |
0 | 78 |
break; |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
79 |
case 8: case 9: case 10: case 11: |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4634
diff
changeset
|
80 |
RaiseWindowWidget(w, _opt_newgame.landscape + 8); |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
81 |
SetNewLandscapeType(e->we.click.widget - 8); |
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
82 |
break; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
83 |
case 12: ShowGameOptions(); break; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
84 |
case 13: ShowGameDifficulty(); break; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
85 |
case 14: ShowPatchesSelection(); break; |
4548
6165e12570bf
(svn r6380) -Codechange: unify all ways to quit OTTD.
rubidium
parents:
4512
diff
changeset
|
86 |
case 15: HandleExitGameRequest(); 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
|
87 |
} |
0 | 88 |
break; |
4308
391dcafb34e5
(svn r5955) -Fix r5728: 2 very important lines for ShowQueryString where removed by excident.
truelight
parents:
4300
diff
changeset
|
89 |
|
391dcafb34e5
(svn r5955) -Fix r5728: 2 very important lines for ShowQueryString where removed by excident.
truelight
parents:
4300
diff
changeset
|
90 |
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break; |
0 | 91 |
} |
92 |
} |
|
93 |
||
94 |
static const WindowDesc _select_game_desc = { |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4171
diff
changeset
|
95 |
WDP_CENTER, WDP_CENTER, 336, 177, |
0 | 96 |
WC_SELECT_GAME,0, |
97 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
98 |
_select_game_widgets, |
|
99 |
SelectGameWndProc |
|
100 |
}; |
|
101 |
||
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
|
102 |
void ShowSelectGameWindow(void) |
0 | 103 |
{ |
104 |
AllocateWindowDesc(&_select_game_desc); |
|
105 |
} |
|
106 |
||
107 |
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
|
108 |
{ 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
|
109 |
{ 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
|
110 |
{ 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
|
111 |
{ 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
|
112 |
{ 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
|
113 |
{ WIDGETS_END }, |
0 | 114 |
}; |
115 |
||
4171 | 116 |
static void AskAbandonGameWndProc(Window *w, WindowEvent *e) |
2639 | 117 |
{ |
118 |
switch (e->event) { |
|
0 | 119 |
case WE_PAINT: |
120 |
DrawWindowWidgets(w); |
|
121 |
#if defined(_WIN32) |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
122 |
SetDParam(0, STR_0133_WINDOWS); |
0 | 123 |
#elif defined(__APPLE__) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
124 |
SetDParam(0, STR_0135_OSX); |
0 | 125 |
#elif defined(__BEOS__) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
126 |
SetDParam(0, STR_OSNAME_BEOS); |
0 | 127 |
#elif defined(__MORPHOS__) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
128 |
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
|
129 |
#elif defined(__AMIGA__) |
587 | 130 |
SetDParam(0, STR_OSNAME_AMIGAOS); |
810
a1494b19bd2a
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents:
774
diff
changeset
|
131 |
#elif defined(__OS2__) |
a1494b19bd2a
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents:
774
diff
changeset
|
132 |
SetDParam(0, STR_OSNAME_OS2); |
0 | 133 |
#else |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
134 |
SetDParam(0, STR_0134_UNIX); |
0 | 135 |
#endif |
2639 | 136 |
DrawStringMultiCenter(90, 38, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178); |
0 | 137 |
return; |
138 |
||
139 |
case WE_CLICK: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
140 |
switch (e->we.click.widget) { |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
141 |
case 3: DeleteWindow(w); break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
142 |
case 4: _exit_game = true; break; |
0 | 143 |
} |
144 |
break; |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
145 |
|
161
74453c59315c
(svn r162) -Feature: when exit game window pops up, 'Enter' quits the game
darkvater
parents:
129
diff
changeset
|
146 |
case WE_KEYPRESS: /* Exit game on pressing 'Enter' */ |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
147 |
switch (e->we.keypress.keycode) { |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
148 |
case WKC_RETURN: |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
149 |
case WKC_NUM_ENTER: |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
150 |
_exit_game = true; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
151 |
break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2204
diff
changeset
|
152 |
} |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
153 |
break; |
0 | 154 |
} |
155 |
} |
|
156 |
||
157 |
static const WindowDesc _ask_abandon_game_desc = { |
|
158 |
WDP_CENTER, WDP_CENTER, 180, 92, |
|
159 |
WC_ASK_ABANDON_GAME,0, |
|
160 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, |
|
161 |
_ask_abandon_game_widgets, |
|
162 |
AskAbandonGameWndProc |
|
163 |
}; |
|
164 |
||
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
|
165 |
void AskExitGame(void) |
0 | 166 |
{ |
167 |
AllocateWindowDescFront(&_ask_abandon_game_desc, 0); |
|
168 |
} |
|
169 |
||
170 |
||
171 |
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
|
172 |
{ 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
|
173 |
{ 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
|
174 |
{ 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
|
175 |
{ 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
|
176 |
{ 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
|
177 |
{ WIDGETS_END }, |
0 | 178 |
}; |
179 |
||
4171 | 180 |
static void AskQuitGameWndProc(Window *w, WindowEvent *e) |
2639 | 181 |
{ |
182 |
switch (e->event) { |
|
183 |
case WE_PAINT: |
|
184 |
DrawWindowWidgets(w); |
|
185 |
DrawStringMultiCenter( |
|
186 |
90, 38, |
|
187 |
_game_mode != GM_EDITOR ? |
|
188 |
STR_0160_ARE_YOU_SURE_YOU_WANT_TO : STR_029B_ARE_YOU_SURE_YOU_WANT_TO, |
|
189 |
178 |
|
190 |
); |
|
191 |
break; |
|
0 | 192 |
|
2639 | 193 |
case WE_CLICK: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
194 |
switch (e->we.click.widget) { |
2639 | 195 |
case 3: DeleteWindow(w); break; |
196 |
case 4: _switch_mode = SM_MENU; break; |
|
197 |
} |
|
0 | 198 |
break; |
661
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
199 |
|
2639 | 200 |
case WE_KEYPRESS: /* Return to main menu on pressing 'Enter' */ |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4548
diff
changeset
|
201 |
if (e->we.keypress.keycode == WKC_RETURN) _switch_mode = SM_MENU; |
2639 | 202 |
break; |
0 | 203 |
} |
204 |
} |
|
205 |
||
206 |
static const WindowDesc _ask_quit_game_desc = { |
|
207 |
WDP_CENTER, WDP_CENTER, 180, 92, |
|
208 |
WC_QUIT_GAME,0, |
|
209 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, |
|
210 |
_ask_quit_game_widgets, |
|
211 |
AskQuitGameWndProc |
|
212 |
}; |
|
213 |
||
214 |
||
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
|
215 |
void AskExitToGameMenu(void) |
0 | 216 |
{ |
217 |
AllocateWindowDescFront(&_ask_quit_game_desc, 0); |
|
218 |
} |