From: PatR Date: Thu, 18 Aug 2022 21:38:45 +0000 (-0700) Subject: '?' entry for 'O' help X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8038f7108d2221e6fc57511240d8ff413e88f129;p=nethack '?' 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? --- diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 6daf25ff4..4285a3f0b 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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 diff --git a/src/cmd.c b/src/cmd.c index b5d34307a..db8bc8a3f 100644 --- 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", diff --git a/src/pager.c b/src/pager.c index 3983216e2..92008a0e4 100644 --- a/src/pager.c +++ b/src/pager.c @@ -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 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; }