]> granicus.if.org Git - nethack/commitdiff
<email deleted>
authornethack.allison <nethack.allison>
Sun, 3 Feb 2002 17:51:54 +0000 (17:51 +0000)
committernethack.allison <nethack.allison>
Sun, 3 Feb 2002 17:51:54 +0000 (17:51 +0000)
The following fixes several bugs:
1) Mismatch between docs and game in definition of what '+' resolved in
favor of docs...
2) When game needs to be recovered a message box is shown.  This is a very
deprecated fix.  It pretty much answers just the conditions that require
this (a yn question to an erroneous winid), and is not useful for other
purposes.
3) The score file is written.

sys/winnt/nttty.c
sys/winnt/winnt.cnf
win/win32/mhmain.c
win/win32/mswproc.c
win/win32/winMS.h
win/win32/winhack.c

index c84d605ec1bb73249c7855186ec57018b8aebf11..91aa624864a238131eba5c3a34ff94a6a5b7f16d 100644 (file)
@@ -290,7 +290,7 @@ static const struct pad {
                        {'h', 'H', C('h')},             /* 4 */
                        {'g', 'g', 'g'},                /* 5 */
                        {'l', 'L', C('l')},             /* 6 */
-                       {'p', 'P', C('p')},             /* + */
+                       {'+', 'P', C('p')},             /* + */
                        {'b', 'B', C('b')},             /* 1 */
                        {'j', 'J', C('j')},             /* 2 */
                        {'n', 'N', C('n')},             /* 3 */
@@ -304,7 +304,7 @@ static const struct pad {
                        {'4', M('4'), '4'},             /* 4 */
                        {'g', 'G', 'g'},                /* 5 */
                        {'6', M('6'), '6'},             /* 6 */
-                       {'p', 'P', C('p')},             /* + */
+                       {'+', 'P', C('p')},             /* + */
                        {'1', M('1'), '1'},             /* 1 */
                        {'2', M('2'), '2'},             /* 2 */
                        {'3', M('3'), '3'},             /* 3 */
index 88e3a46e651e1b2c25ab9f16aa824747d8498d62..275abc469ad9460a28979649d6dbe513d6e18ff8 100644 (file)
@@ -28,7 +28,7 @@ OPTIONS=IBMGraphics
 # General options.  You might also set "silent" so as not to attract
 # the boss's attention.
 #
-OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space
+OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space,toptenwin
 #
 # If you want to get rid of "use #quit to quit..." use:
 #OPTIONS=suppress_alert:3.3.1
index 35db3c509e5bbc2c27ed1164df089256140cd2be..5140481c2e6bfe11ea5ac61b93c0fd82988d1bfb 100644 (file)
@@ -103,7 +103,7 @@ keypad[KEY_LAST][3] = {
        {'h', 'H', C('h')}, /* 4 */
        {'g', 'g', 'g'}, /* 5 */
        {'l', 'L', C('l')}, /* 6 */
-       {'p', 'P', C('p')}, /* + */
+       {'+', 'P', C('p')}, /* + */
        {'b', 'B', C('b')}, /* 1 */
        {'j', 'J', C('j')}, /* 2 */
        {'n', 'N', C('n')}, /* 3 */
@@ -118,7 +118,7 @@ numpad[KEY_LAST][3] = {
        {'4', M('4'), '4'}, /* 4 */
        {'g', 'G', 'g'}, /* 5 */
        {'6', M('6'), '6'}, /* 6 */
-       {'p', 'P', C('p')}, /* + */
+       {'+', 'P', C('p')}, /* + */
        {'1', M('1'), '1'}, /* 1 */
        {'2', M('2'), '2'}, /* 2 */
        {'3', M('3'), '3'}, /* 3 */
index 3f64005afc53b7001744c0bf59ea44f16f7b233c..f1d60d1be8a96ef8ad0379ebbb3434d1a78d922e 100644 (file)
@@ -141,14 +141,10 @@ void mswin_askname(void)
 {
        logDebug("mswin_askname()\n");
 
-#ifdef _DEBUG
-       strcpy(plname, "wizard");
-#else
-       if( mswin_getlin_window("who are you?", plname, PL_NSIZ)==IDCANCEL ) {
+       if( mswin_getlin_window("Who are you?", plname, PL_NSIZ)==IDCANCEL ) {
                bail("bye-bye");
                /* not reached */
        }
-#endif
 }
 
 
@@ -167,8 +163,6 @@ void mswin_get_nh_event(void)
 void mswin_exit_nhwindows(const char *str)
 {
        logDebug("mswin_exit_nhwindows(%s)\n", str);
-
-       terminate(EXIT_SUCCESS);
 }
 
 /* Prepare the window to be suspended. */
@@ -447,6 +441,13 @@ void mswin_putstr(winid wid, int attr, const char *text)
                                 WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data );
                }
        }
+       else
+       {
+               // build text to display later in message box
+               GetNHApp()->saved_text = realloc(GetNHApp()->saved_text, strlen(text) +
+                       strlen(GetNHApp()->saved_text) + 1);
+               strcat(GetNHApp()->saved_text, text);
+       }
 }
 
 /* Display the file named str.  Complain about missing files
@@ -854,6 +855,22 @@ char mswin_yn_function(const char *question, const char *choices,
 
        logDebug("mswin_yn_function(%s, %s, %d)\n", question, choices, def);
 
+    if (WIN_MESSAGE == WIN_ERR && choices == ynchars) {
+        char *text = realloc(strdup(GetNHApp()->saved_text), strlen(question)
+                       + strlen(GetNHApp()->saved_text) + 1);
+        DWORD box_result;
+        strcat(text, question);
+        box_result = MessageBox(NULL,
+             NH_W2A(text, message, sizeof(message)),
+             TEXT("NetHack for Windows"),
+             MB_YESNOCANCEL |
+             ((def == 'y') ? MB_DEFBUTTON1 :
+              (def == 'n') ? MB_DEFBUTTON2 : MB_DEFBUTTON3));
+        free(text);
+               GetNHApp()->saved_text = strdup(TEXT(""));
+        return box_result == IDYES ? 'y' : box_result == IDNO ? 'n' : '\033';
+    }
+
     if (choices) {
        char *cb, choicebuf[QBUFSZ];
        Strcpy(choicebuf, choices);
index a895138c0d344b530718666d1e8b05ec143f6171..8a47f5af359f9ec76847a4bec7e4ee6e484e6616 100644 (file)
@@ -54,6 +54,8 @@ typedef struct mswin_nhwindow_app {
 
        int                     winStatusAlign;         /* alignment of the status window */
        int                     winMessageAlign;        /* alignment of the status window */
+
+       char*           saved_text;
 } NHWinApp, *PNHWinApp;
 extern PNHWinApp GetNHApp();
 
index ac40bee19a03e61f0bd3f7b5e9df41cf8447e90b..87c84dfebf797e7f741e266ba4f75f4dae2432cc 100644 (file)
@@ -62,6 +62,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
        _nethack_app.winStatusAlign = NHWND_ALIGN_BOTTOM;
        _nethack_app.winMessageAlign = NHWND_ALIGN_TOP;
        _nethack_app.mapCliparoundMargin = DEF_CLIPAROUND_MARGIN;
+       _nethack_app.saved_text = strdup(TEXT(""));
 
        // init controls
        ZeroMemory(&InitCtrls, sizeof(InitCtrls));
@@ -75,10 +76,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
                return FALSE;
        }
 
-#ifdef _DEBUG
-       wizard = TRUE;
-#endif
-
        /* get command line parameters */       
        p = _tcstok(GetCommandLine(), TEXT(" "));
        for( argc=0; p && argc<MAX_CMDLINE_PARAM; argc++ ) {