]> granicus.if.org Git - nethack/commitdiff
keylist help (? i) fixes
authorPatR <rankin@nethack.org>
Tue, 8 Dec 2020 23:58:02 +0000 (15:58 -0800)
committerPatR <rankin@nethack.org>
Tue, 8 Dec 2020 23:58:02 +0000 (15:58 -0800)
I was implementing a routine to show all the key bindings
when I discovered that we already have one.  This fixes a few
small problems:  'n' prefix for number entry was missing for
number_pad mode.  Meta+<direction> for running in number_pad
mode was missing too.  ^A was present but being suppressed by
lack of #define for obsolete #if REDO.  And ^C was shown as ^c
while all other ^ characters appear in upper case.  Once ^A
appeared as the line before it, the inconsistency stood out.

I also changed the slightly verbose "Shift-<direction>" and
"Ctrl-<direction>" entries below the direction grid to use plus
instead of minus signs.  Plus emphasizes that two things are
combined so seems more intuitive.  (I left "M-c" alone.)

doc/fixes37.0
src/cmd.c

index dcc080db7b293986f0eb0f426e334018902fe3f4..c36d0c43ef554d0642de704a3b104095a2af772f 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.379 $ $NHDT-Date: 1607461111 2020/12/08 20:58:31 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.380 $ $NHDT-Date: 1607471879 2020/12/08 23:57:59 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -320,6 +320,8 @@ when saving while punished or game ends while punished, handling for ball and
        chain might access freed memory with unpredictable consequences
 brown pudding monster hitting another monster with decay attack corroded armor
        instead of rotting it
+<?> -> <full key bindings> omitted 'n' prefix and M-digit for number_pad mode,
+       and ^A/re-do was suppressed due lack of obsolete '#define REDO'
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index df38ac840f0f8377ea5f7d500067f99e2d6c1bfb..bd348ae8dbe8d1b7b92f28165a1144975de74644 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 cmd.c   $NHDT-Date: 1607339290 2020/12/07 11:08:10 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.428 $ */
+/* NetHack 3.7 cmd.c   $NHDT-Date: 1607471879 2020/12/08 23:57:59 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.429 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2161,7 +2161,7 @@ dokeylist(VOID_ARGS)
 {
     char buf[BUFSZ], buf2[BUFSZ];
     uchar key;
-    boolean keys_used[256] = {0};
+    boolean keys_used[256];
     winid datawin;
     int i;
     static const char
@@ -2186,12 +2186,14 @@ dokeylist(VOID_ARGS)
           "Prefix: run without picking up objects/fighting", FALSE },
         { NHKF_DOINV, "view inventory", TRUE },
         { NHKF_REQMENU, "Prefix: request a menu", FALSE },
-#ifdef REDO
+        { NHKF_COUNT,
+          "Prefix: for digits when prefixing a command with a count", TRUE },
         { NHKF_DOAGAIN , "re-do: perform the previous command again", FALSE },
-#endif
         { 0, (const char *) 0, FALSE }
     };
 
+    (void) memset((genericptr_t) keys_used, 0, sizeof keys_used);
+
     datawin = create_nhwindow(NHW_TEXT);
     putstr(datawin, 0, "");
     putstr(datawin, 0, "            Full Current Key Bindings List");
@@ -2226,12 +2228,24 @@ dokeylist(VOID_ARGS)
             = keys_used[(uchar) C(g.Cmd.move_SE)] = TRUE;
         putstr(datawin, 0, "");
         putstr(datawin, 0,
-          "Shift-<direction> will move in specified direction until you hit");
-        putstr(datawin, 0, "        a wall or run into something.");
-        putstr(datawin, 0,
-          "Ctrl-<direction> will run in specified direction until something");
-        putstr(datawin, 0, "        very interesting is seen.");
+     "Ctrl+<direction> will run in specified direction until something very");
+        Sprintf(buf, "%8s %s", "", "interesting is seen.");
+        putstr(datawin, 0, buf);
+        Strcpy(buf, "Shift");
+    } else {
+        /* num_pad */
+        keys_used[(uchar) M('1')] = keys_used[(uchar) M('2')]
+            = keys_used[(uchar) M('3')] = keys_used[(uchar) M('4')]
+            = keys_used[(uchar) M('6')] = keys_used[(uchar) M('7')]
+            = keys_used[(uchar) M('8')] = keys_used[(uchar) M('9')] = TRUE;
+        putstr(datawin, 0, "");
+        Strcpy(buf, "Meta");
     }
+    Strcat(buf,
+          "+<direction> will run in specified direction until you encounter");
+    putstr(datawin, 0, buf);
+    Sprintf(buf, "%8s %s", "", "an obstacle.");
+    putstr(datawin, 0, buf);
 
     putstr(datawin, 0, "");
     putstr(datawin, 0, "Miscellaneous keys:");
@@ -2245,8 +2259,10 @@ dokeylist(VOID_ARGS)
         }
     }
 #ifndef NO_SIGNAL
-    putstr(datawin, 0, "^c       break out of NetHack (SIGINT)");
     keys_used[(uchar) C('c')] = TRUE;
+    Sprintf(buf, "%-8s %s", key2txt(C('c'), buf2),
+            "break out of NetHack (SIGINT)");
+    putstr(datawin, 0, buf);
 #endif
 
     putstr(datawin, 0, "");
@@ -2778,7 +2794,7 @@ wiz_migrate_mons()
 }
 #endif
 
-struct {
+static struct {
     int nhkf;
     char key;
     const char *name;