(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:
nethack.allison
2002-03-06 05:16:17 +00:00
parent 3ca42c2265
commit 5037e538df
3 changed files with 58 additions and 20 deletions
+15 -4
View File
@@ -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;