'?' entry for 'O' help

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?
This commit is contained in:
PatR
2022-08-18 14:38:45 -07:00
parent 76c000ec11
commit 8038f7108d
3 changed files with 50 additions and 13 deletions
+1
View 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 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 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 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 curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support also included tty support
+2 -1
View File
@@ -2612,7 +2612,8 @@ struct ext_func_tab extcmdlist[] = {
{ 'S', "save", "save the game and exit", { 'S', "save", "save the game and exit",
dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL }, dosave, IFBURIED | GENERALCMD | NOFUZZERCMD, NULL },
{ '\0', "saveoptions", "save the game configuration", { '\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", { 's', "search", "search for traps and secret doors",
dosearch, IFBURIED | CMD_M_PREFIX, "searching" }, dosearch, IFBURIED | CMD_M_PREFIX, "searching" },
{ '*', "seeall", "show all equipment in use", { '*', "seeall", "show all equipment in use",
+47 -12
View File
@@ -19,7 +19,8 @@ static void checkfile(char *, struct permonst *, boolean, boolean, char *);
static int add_cmap_descr(int, int, int, int, coord, static int add_cmap_descr(int, int, int, int, coord,
const char *, const char *, const char *, const char *,
boolean *, const char **, 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_all(boolean, boolean);
static void look_traps(boolean); static void look_traps(boolean);
static void do_supplemental_info(char *, struct permonst *, boolean); static void do_supplemental_info(char *, struct permonst *, boolean);
@@ -2464,24 +2465,58 @@ dohelp(void)
RESTORE_WARNING_FORMAT_NONLITERAL RESTORE_WARNING_FORMAT_NONLITERAL
/* format the key or extended command name of command used to set options; /* 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 * static char *
setopt_cmd(char *outbuf) setopt_cmd(char *outbuf)
{ {
char cmdnambuf[QBUFSZ]; char cmdbuf[QBUFSZ];
const char *cmdname; const char *cmdnm;
char key = cmd_from_func(doset); char key;
Strcpy(outbuf, "\'");
/* #optionsfull */
key = cmd_from_func(doset);
if (key) { if (key) {
/* key value enclosed within single quotes */ Strcat(outbuf, visctrl(key));
Sprintf(outbuf, "'%s'", visctrl(key));
} else { } else {
/* extended command name, with leading "#", also in single quotes */ /* extended command name, with leading "#" */
cmdname = cmdname_from_func(doset, cmdnambuf, TRUE); cmdnm = cmdname_from_func(doset, cmdbuf, TRUE);
if (!cmdname) /* paranoia */ if (!cmdnm) /* paranoia */
cmdname = "options"; cmdnm = "optionsfull";
Sprintf(outbuf, "'%s%.31s'", (*cmdname != '#') ? "#" : "", cmdname); 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; return outbuf;
} }