(from Yitzhak)
Addresses <Someone>'s point that ALT-F4 in game-over, still brings up the save/quit/cancel dialog box. This makes ALT-F4 equivalent to quitting without any further disclosure/windows, but makes sure the game exits properly so it will save the bones and the record file. I also cleaned up the mhrip.c to use macros for all magic numbers.
This commit is contained in:
+15
-4
@@ -408,10 +408,21 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPar
|
||||
case WM_CLOSE:
|
||||
{
|
||||
/* exit gracefully */
|
||||
switch(MessageBox(hWnd, TEXT("Save?"), TEXT("NetHack for Windows"), MB_YESNOCANCEL | MB_ICONQUESTION)) {
|
||||
case IDYES: NHEVENT_KBD('y'); dosave(); break;
|
||||
case IDNO: NHEVENT_KBD('q'); done(QUIT); break;
|
||||
case IDCANCEL: break;
|
||||
if (program_state.gameover)
|
||||
{
|
||||
/* assume the user really meant this, as the game is already over... */
|
||||
/* to make sure we still save bones, just set stop printing flag */
|
||||
program_state.stopprint++;
|
||||
NHEVENT_KBD('\033'); /* and send keyboard input as if user pressed ESC */
|
||||
/* additional code for this is done in menu and rip windows */
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(MessageBox(hWnd, TEXT("Save?"), TEXT("NetHack for Windows"), MB_YESNOCANCEL | MB_ICONQUESTION)) {
|
||||
case IDYES: NHEVENT_KBD('y'); dosave(); break;
|
||||
case IDNO: NHEVENT_KBD('q'); done(QUIT); break;
|
||||
case IDCANCEL: break;
|
||||
}
|
||||
}
|
||||
} return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user