]> granicus.if.org Git - nethack/commitdiff
fix #2251 - M-5 operation with number_pad:2
authornethack.rankin <nethack.rankin>
Wed, 13 Apr 2011 01:36:40 +0000 (01:36 +0000)
committernethack.rankin <nethack.rankin>
Wed, 13 Apr 2011 01:36:40 +0000 (01:36 +0000)
     From a bug report, using Alt+5 when number_pad mode
is set to MSDOS compatibility (where Alt+5 is supposed to function as the
'G' movement prefix) didn't work correctly.  The code that did M-5 to G
conversion was being executed after the code which should have gotten G's
direction, resulting in strange behavior, probably using stale values for
u.dx and u.dy.  (With current dev code, I evidently had u.dx==0 && u.dy==0
so was getting "You can't get there from here..." which is actually pretty
amusing in the current context.  3.4.3 didn't have that feedback so I'm
not sure what happened in it; possibly just silent refusal to move.)

doc/fixes34.4
src/cmd.c

index f26efe0b2c84d141c5f88d5863646adb1c53784a..074291a5b97a896d15e3f726b76f0f7c164d70f0 100644 (file)
@@ -402,6 +402,8 @@ when polymorphed into an opposite sex monster, if you then become a new
        human while failing to polymorph into something else, you'd be told
        "you feel like a new man" for female or "a new woman" for male  
 the weight of a non-cursed bag of holding was sometimes off by 1 unit
+for number_pad:2 (MSDOS compatibility), M-5 (Alt+5, or Shift+keypad5 using
+       MSDOS/Windows keystroke hackery) didn't function as G movement prefix
 
 
 Platform- and/or Interface-Specific Fixes
index df7c9e0dc6d98c710f3aaf0fd1cfd19191bee650..751aa9b633dcad074976cc0bb3b687853c0f593b 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2800,18 +2800,6 @@ register char *cmd;
                context.move = FALSE;
                return;         /* probably we just had an interrupt */
        }
-       if (Cmd.pcHack_compat) {
-               /* This handles very old inconsistent DOS/Windows behaviour
-                * in a new way: earlier, the keyboard handler mapped these,
-                * which caused counts to be strange when entered from the
-                * number pad. Now do not map them until here. 
-                */
-               switch (*cmd) {
-                   case '5':       *cmd = 'g'; break;
-                   case M('5'):    *cmd = 'G'; break;
-                   case M('0'):    *cmd = 'I'; break;
-               }
-       }
 
        /* handle most movement commands */
        do_walk = do_rush = prefix_seen = FALSE;
@@ -3412,6 +3400,20 @@ parse()
        } else {
            save_cm = (char *)0;
        }
+       /* in 3.4.3 this was in rhack(), where it was too late to handle M-5 */
+       if (Cmd.pcHack_compat) {
+           /* This handles very old inconsistent DOS/Windows behaviour
+              in a different way: earlier, the keyboard handler mapped
+              these, which caused counts to be strange when entered
+              from the number pad. Now do not map them until here. */
+           switch (foo) {
+           case '5':    foo = 'g'; break;
+           case M('5'): foo = 'G'; break;
+           case M('0'): foo = 'I'; break;
+           default:     break; /* as is */
+           }
+       }
+
        in_line[0] = foo;
        in_line[1] = '\0';
        if (foo == 'g' || foo == 'G' || foo == 'm' || foo == 'M' ||