author | truelight |
Thu, 24 Mar 2005 14:43:40 +0000 | |
changeset 1540 | 6eef12dab5bf |
parent 1500 | a66721629bc0 |
child 1618 | 70408b5c4e28 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
206
diff
changeset
|
3 |
#include "table/strings.h" |
0 | 4 |
#include "window.h" |
5 |
#include "gui.h" |
|
6 |
#include "viewport.h" |
|
7 |
#include "gfx.h" |
|
8 |
#include "player.h" |
|
129
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
126
diff
changeset
|
9 |
#include "command.h" |
126 | 10 |
#include "console.h" |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
11 |
#include "network.h" |
0 | 12 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
13 |
extern void SwitchMode(int new_mode); |
0 | 14 |
|
15 |
/* |
|
16 |
static void ShowSelectTutorialWindow() |
|
17 |
{ |
|
18 |
} |
|
19 |
*/ |
|
20 |
||
21 |
static const Widget _select_game_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
22 |
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
23 |
{ WWT_IMGBTN, RESIZE_NONE, 13, 0, 335, 14, 196, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
24 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
25 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
26 |
//{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 177, 188, STR_0142_TUTORIAL_DEMONSTRATION, STR_02FD_VIEW_DEMONSTRATIONS_TUTORIALS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
27 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 177, 188, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
28 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 40, 51, STR_0220_CREATE_SCENARIO,STR_02FE_CREATE_A_CUSTOMIZED_GAME}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
29 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 136, 147, STR_SINGLE_PLAYER, STR_02FF_SELECT_SINGLE_PLAYER_GAME}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
30 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 136, 147, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
31 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 159, 170, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
32 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 159, 170, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
33 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
34 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 177, 188, STR_0304_QUIT, STR_0305_QUIT_OPENTTD}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
35 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 10, 85, 69, 122, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
36 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 90, 165, 69, 122, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
37 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 170, 245, 69, 122, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
38 |
{ WWT_PANEL_2, RESIZE_NONE, 12, 250, 325, 69, 122, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
39 |
{ WIDGETS_END}, |
0 | 40 |
}; |
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 |
|
0 | 45 |
static void SelectGameWndProc(Window *w, WindowEvent *e) { |
46 |
switch(e->event) { |
|
47 |
case WE_PAINT: |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1390
diff
changeset
|
48 |
w->click_state = (w->click_state & ~(0xC0) & ~(0xF << 12)) | (1 << (_opt_newgame.landscape + 12)) | (1<<6); |
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1390
diff
changeset
|
49 |
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level); |
0 | 50 |
DrawWindowWidgets(w); |
51 |
break; |
|
52 |
||
53 |
case WE_CLICK: |
|
54 |
switch(e->click.widget) { |
|
55 |
case 2: DoCommandP(0, 0, 0, NULL, CMD_START_NEW_GAME); break; |
|
56 |
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break; |
|
57 |
case 4: ShowPatchesSelection(); break; |
|
58 |
case 5: DoCommandP(0, InteractiveRandom(), 0, NULL, CMD_CREATE_SCENARIO); break; |
|
59 |
case 7: |
|
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
770
diff
changeset
|
60 |
#ifdef ENABLE_NETWORK |
105 | 61 |
if (!_network_available) { |
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
770
diff
changeset
|
62 |
ShowErrorMessage(-1, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); |
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
770
diff
changeset
|
63 |
} 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
|
64 |
ShowNetworkGameWindow(); |
774
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
770
diff
changeset
|
65 |
#else |
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
770
diff
changeset
|
66 |
ShowErrorMessage(-1 ,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); |
bb9ec520a1b1
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
darkvater
parents:
770
diff
changeset
|
67 |
#endif /* ENABLE_NETWORK */ |
0 | 68 |
break; |
69 |
case 8: ShowGameOptions(); break; |
|
70 |
case 9: ShowGameDifficulty(); break; |
|
71 |
case 10:ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break; |
|
72 |
case 11:AskExitGame(); break; |
|
73 |
case 12: case 13: case 14: case 15: |
|
74 |
DoCommandP(0, e->click.widget - 12, 0, NULL, CMD_SET_NEW_LANDSCAPE_TYPE); |
|
75 |
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
|
76 |
} |
0 | 77 |
break; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
78 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
79 |
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
80 |
case WE_ON_EDIT_TEXT_CANCEL: HandleOnEditTextCancel(); break; |
0 | 81 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
82 |
|
0 | 83 |
} |
84 |
||
85 |
static const WindowDesc _select_game_desc = { |
|
86 |
WDP_CENTER, WDP_CENTER, 336, 197, |
|
87 |
WC_SELECT_GAME,0, |
|
88 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
89 |
_select_game_widgets, |
|
90 |
SelectGameWndProc |
|
91 |
}; |
|
92 |
||
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
|
93 |
void ShowSelectGameWindow(void) |
0 | 94 |
{ |
95 |
AllocateWindowDesc(&_select_game_desc); |
|
96 |
} |
|
97 |
||
98 |
||
99 |
// p1 = mode |
|
100 |
// 0 - start new game |
|
101 |
// 1 - close new game dialog |
|
102 |
||
103 |
int32 CmdStartNewGame(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
104 |
{ |
|
105 |
if (!(flags & DC_EXEC)) |
|
106 |
return 0; |
|
107 |
||
108 |
switch(p1) { |
|
109 |
case 0: // show select game window |
|
110 |
AskForNewGameToStart(); |
|
111 |
break; |
|
112 |
case 1: // close select game window |
|
113 |
DeleteWindowById(WC_SAVELOAD, 0); |
|
114 |
break; |
|
115 |
} |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
116 |
|
0 | 117 |
return 0; |
118 |
} |
|
119 |
||
120 |
int32 CmdGenRandomNewGame(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
121 |
{ |
|
122 |
if (!(flags & DC_EXEC)) |
|
123 |
return 0; |
|
124 |
||
125 |
// this forces stuff into test mode. |
|
126 |
_docommand_recursive = 0; |
|
127 |
||
206 | 128 |
_random_seeds[0][0] = p1; |
129 |
_random_seeds[0][1] = p2; |
|
0 | 130 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
131 |
SwitchMode(SM_NEWGAME); |
0 | 132 |
return 0; |
133 |
} |
|
134 |
||
135 |
int32 CmdLoadGame(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
136 |
{ |
|
137 |
if (!(flags & DC_EXEC)) |
|
138 |
return 0; |
|
139 |
||
140 |
// ShowSaveLoadDialog(0); |
|
141 |
return 0; |
|
142 |
} |
|
143 |
||
144 |
int32 CmdCreateScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
145 |
{ |
|
146 |
if (!(flags & DC_EXEC)) |
|
147 |
return 0; |
|
148 |
||
149 |
_switch_mode = SM_EDITOR; |
|
150 |
return 0; |
|
151 |
} |
|
152 |
||
153 |
int32 CmdSetSinglePlayer(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
154 |
{ |
|
155 |
printf("CmdSetSinglePlayer\n"); |
|
156 |
return 0; |
|
157 |
} |
|
158 |
||
159 |
int32 CmdStartScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
160 |
{ |
|
161 |
if (!(flags & DC_EXEC)) |
|
162 |
return 0; |
|
163 |
||
164 |
// this forces stuff into test mode. |
|
165 |
_docommand_recursive = 0; |
|
166 |
||
206 | 167 |
_random_seeds[0][0] = p1; |
168 |
_random_seeds[0][1] = p2; |
|
0 | 169 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
170 |
SwitchMode(SM_START_SCENARIO); |
0 | 171 |
return 0; |
172 |
} |
|
173 |
||
174 |
||
175 |
static const Widget _ask_abandon_game_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
176 |
{ WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
177 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_00C7_QUIT, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
178 |
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
179 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
180 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
181 |
{ WIDGETS_END}, |
0 | 182 |
}; |
183 |
||
184 |
static void AskAbandonGameWndProc(Window *w, WindowEvent *e) { |
|
185 |
switch(e->event) { |
|
186 |
case WE_PAINT: |
|
187 |
DrawWindowWidgets(w); |
|
188 |
#if defined(_WIN32) |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
189 |
SetDParam(0, STR_0133_WINDOWS); |
0 | 190 |
#elif defined(__APPLE__) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
191 |
SetDParam(0, STR_0135_OSX); |
0 | 192 |
#elif defined(__BEOS__) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
193 |
SetDParam(0, STR_OSNAME_BEOS); |
0 | 194 |
#elif defined(__MORPHOS__) |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
195 |
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
|
196 |
#elif defined(__AMIGA__) |
587 | 197 |
SetDParam(0, STR_OSNAME_AMIGAOS); |
810
a1494b19bd2a
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents:
774
diff
changeset
|
198 |
#elif defined(__OS2__) |
a1494b19bd2a
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
truelight
parents:
774
diff
changeset
|
199 |
SetDParam(0, STR_OSNAME_OS2); |
0 | 200 |
#else |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
201 |
SetDParam(0, STR_0134_UNIX); |
0 | 202 |
#endif |
203 |
DrawStringMultiCenter(0x5A, 0x26, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178); |
|
204 |
return; |
|
205 |
||
206 |
case WE_CLICK: |
|
207 |
switch(e->click.widget) { |
|
208 |
case 3: |
|
209 |
DeleteWindow(w); |
|
210 |
break; |
|
211 |
case 4: |
|
212 |
_exit_game = true; |
|
213 |
break; |
|
214 |
} |
|
215 |
break; |
|
161
74453c59315c
(svn r162) -Feature: when exit game window pops up, 'Enter' quits the game
darkvater
parents:
129
diff
changeset
|
216 |
case WE_KEYPRESS: /* Exit game on pressing 'Enter' */ |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1093
diff
changeset
|
217 |
if (e->keypress.keycode == WKC_RETURN || e->keypress.keycode == WKC_NUM_ENTER) |
161
74453c59315c
(svn r162) -Feature: when exit game window pops up, 'Enter' quits the game
darkvater
parents:
129
diff
changeset
|
218 |
_exit_game = true; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
219 |
break; |
0 | 220 |
} |
221 |
} |
|
222 |
||
223 |
static const WindowDesc _ask_abandon_game_desc = { |
|
224 |
WDP_CENTER, WDP_CENTER, 180, 92, |
|
225 |
WC_ASK_ABANDON_GAME,0, |
|
226 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, |
|
227 |
_ask_abandon_game_widgets, |
|
228 |
AskAbandonGameWndProc |
|
229 |
}; |
|
230 |
||
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
|
231 |
void AskExitGame(void) |
0 | 232 |
{ |
233 |
AllocateWindowDescFront(&_ask_abandon_game_desc, 0); |
|
234 |
} |
|
235 |
||
236 |
||
237 |
static const Widget _ask_quit_game_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
238 |
{ WWT_TEXTBTN, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
239 |
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_0161_QUIT_GAME, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
240 |
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
241 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
810
diff
changeset
|
242 |
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
172
diff
changeset
|
243 |
{ WIDGETS_END}, |
0 | 244 |
}; |
245 |
||
246 |
static void AskQuitGameWndProc(Window *w, WindowEvent *e) { |
|
247 |
switch(e->event) { |
|
248 |
case WE_PAINT: |
|
249 |
DrawWindowWidgets(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
250 |
DrawStringMultiCenter(0x5A, 0x26, |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
251 |
_game_mode != GM_EDITOR ? STR_0160_ARE_YOU_SURE_YOU_WANT_TO : |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
252 |
STR_029B_ARE_YOU_SURE_YOU_WANT_TO, |
0 | 253 |
178); |
254 |
return; |
|
255 |
||
256 |
case WE_CLICK: |
|
257 |
switch(e->click.widget) { |
|
258 |
case 3: |
|
259 |
DeleteWindow(w); |
|
260 |
break; |
|
261 |
case 4: |
|
262 |
_switch_mode = SM_MENU; |
|
263 |
break; |
|
264 |
} |
|
265 |
break; |
|
661
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
266 |
|
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
267 |
case WE_KEYPRESS: /* Return to main menu on pressing 'Enter' */ |
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
268 |
if (e->keypress.keycode == WKC_RETURN) |
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
269 |
_switch_mode = SM_MENU; |
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
270 |
break; |
0d0a151aa4cd
(svn r1095) -Fix: scenario editor road-build-gui works again altough shortcuts are screwed.
darkvater
parents:
654
diff
changeset
|
271 |
|
0 | 272 |
} |
273 |
} |
|
274 |
||
275 |
static const WindowDesc _ask_quit_game_desc = { |
|
276 |
WDP_CENTER, WDP_CENTER, 180, 92, |
|
277 |
WC_QUIT_GAME,0, |
|
278 |
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, |
|
279 |
_ask_quit_game_widgets, |
|
280 |
AskQuitGameWndProc |
|
281 |
}; |
|
282 |
||
283 |
||
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
|
284 |
void AskExitToGameMenu(void) |
0 | 285 |
{ |
286 |
AllocateWindowDescFront(&_ask_quit_game_desc, 0); |
|
287 |
} |
|
288 |
||
289 |
int32 CmdSetNewLandscapeType(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
|
290 |
{ |
|
291 |
if (flags & DC_EXEC) { |
|
1500
a66721629bc0
(svn r2004) - Fix: [ 1149487 ] Autosave ignoring settings
Darkvater
parents:
1390
diff
changeset
|
292 |
_opt_newgame.landscape = p1; |
0 | 293 |
InvalidateWindowClasses(WC_SELECT_GAME); |
294 |
} |
|
295 |
return 0; |
|
296 |
} |