]> granicus.if.org Git - nethack/commitdiff
'?' entry for 'O' help
authorPatR <rankin@nethack.org>
Thu, 18 Aug 2022 21:38:45 +0000 (14:38 -0700)
committerPatR <rankin@nethack.org>
Thu, 18 Aug 2022 21:38:45 +0000 (14:38 -0700)
Update the menu for the help command to change
  "i - using the 'O' command to set options"
to
  "i - using the '#optionsfull' or 'm O' command to set options"
(examples assume default key bindings but the actual help menu shows
currently bound keys; the "or 'foo'" part is omitted if #optionsfull
is bound to a key).

dat/opthelp should probably be updated to describe how doset_simple
works since that is different from normal menus and explicitly
contradicts the existing description for boolean settings being
deferred until the menu gets dismissed.  Any changes need to make
sense if displayed in the context of picking '?' in #optionsfull.
Maybe a separate help file and separate entry for it in '?' menu?

doc/fixes3-7-0.txt
src/cmd.c
src/pager.c

index 6daf25ff401f78baf632d33f70de6ee06d913d85..4285a3f0b0ba394042dee176306074c60a063cd9 100644 (file)
@@ -1357,6 +1357,7 @@ when using --nethackrc=file on the command line (currently only implemented
        containing 'file' before using it as the RC file name
 using 'o'pen as a synonym for #loot of a container at the hero's location did
        not work if the hero was in a pit
+update '?' menu to reflect change to 'O' command
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index b5d34307a9c5a212d74205ef883a204f2a767b39..db8bc8a3f5b9b2e63a7685d4f4359ec0b8742619 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2612,7 +2612,8 @@ struct ext_func_tab extcmdlist[] = {
     { 'S',    "save", "save the game and exit",
               dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
     { '\0',   "saveoptions", "save the game configuration",
-              do_write_config_file, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
+              do_write_config_file,
+              IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
     { 's',    "search", "search for traps and secret doors",
               dosearch, IFBURIED | CMD_M_PREFIX, "searching" },
     { '*',    "seeall", "show all equipment in use",
index 3983216e2f18d92e98d9df62f2782f1f8f252116..92008a0e400fa57f70128a26bca393acebcb1b3e 100644 (file)
@@ -19,7 +19,8 @@ static void checkfile(char *, struct permonst *, boolean, boolean, char *);
 static int add_cmap_descr(int, int, int, int, coord,
                           const char *, const char *,
                           boolean *, const char **, char *);
-static void look_region_nearby(coordxy *, coordxy *, coordxy *, coordxy *, boolean);
+static void look_region_nearby(coordxy *, coordxy *, coordxy *, coordxy *,
+                               boolean);
 static void look_all(boolean, boolean);
 static void look_traps(boolean);
 static void do_supplemental_info(char *, struct permonst *, boolean);
@@ -2464,24 +2465,58 @@ dohelp(void)
 RESTORE_WARNING_FORMAT_NONLITERAL
 
 /* format the key or extended command name of command used to set options;
-   normally 'O' but could be bound to something else, or not bound at all */
+   normally 'O' but could be bound to something else, or not bound at all;
+   with the implementation of a simple options subset, now need 'mO' to get
+   the full options command; format it as 'm O' */
 static char *
 setopt_cmd(char *outbuf)
 {
-    char cmdnambuf[QBUFSZ];
-    const char *cmdname;
-    char key = cmd_from_func(doset);
+    char cmdbuf[QBUFSZ];
+    const char *cmdnm;
+    char key;
 
+    Strcpy(outbuf, "\'");
+    /* #optionsfull */
+    key = cmd_from_func(doset);
     if (key) {
-        /* key value enclosed within single quotes */
-        Sprintf(outbuf, "'%s'", visctrl(key));
+        Strcat(outbuf, visctrl(key));
     } else {
-        /* extended command name, with leading "#", also in single quotes */
-        cmdname = cmdname_from_func(doset, cmdnambuf, TRUE);
-        if (!cmdname) /* paranoia */
-            cmdname = "options";
-        Sprintf(outbuf, "'%s%.31s'", (*cmdname != '#') ? "#" : "", cmdname);
+        /* extended command name, with leading "#" */
+        cmdnm = cmdname_from_func(doset, cmdbuf, TRUE);
+        if (!cmdnm) /* paranoia */
+            cmdnm = "optionsfull";
+        Sprintf(eos(outbuf), "%s%.31s", (*cmdnm != '#') ? "#" : "", cmdnm);
+
+        /* since there's no key bound to #optionsfull, include 'm O' */
+        Strcat(outbuf, "\' or \'");
+        /* m prefix plus #options */
+        key = cmd_from_func(do_reqmenu);
+        if (key) {
+            /* key for 'm' prefix */
+            Strcat(outbuf, visctrl(key));
+        } else {
+            /* extended command name for 'm' prefix */
+            cmdnm = cmdname_from_func(do_reqmenu, cmdbuf, TRUE);
+            if (!cmdnm)
+                cmdnm = "reqmenu";
+            Sprintf(eos(outbuf), "%s%.31s", (*cmdnm != '#') ? "#" : "", cmdnm);
+        }
+        /* this is slightly iffy because the user shouldn't type <space> to
+           get the command we're describing, but it improves readability */
+        Strcat(outbuf, " ");
+        /* now #options, normally 'O' */
+        key = cmd_from_func(doset_simple);
+        if (key) {
+            Strcat(outbuf, visctrl(key));
+        } else {
+            /* extended command name */
+            cmdnm = cmdname_from_func(doset_simple, cmdbuf, TRUE);
+            if (!cmdnm) /* paranoia */
+                cmdnm = "options";
+            Sprintf(eos(outbuf), "%s%.31s", (*cmdnm != '#') ? "#" : "", cmdnm);
+        }
     }
+    Strcat(outbuf, "\'");
     return outbuf;
 }