]> granicus.if.org Git - nethack/commitdiff
options help
authorPatR <rankin@nethack.org>
Thu, 26 Nov 2020 10:20:00 +0000 (02:20 -0800)
committerPatR <rankin@nethack.org>
Thu, 26 Nov 2020 10:20:00 +0000 (02:20 -0800)
The revamped options handling was't doing dynamic help properly.
After listing the booleans, it listed them again amongest the
compound options.  Since their description field is Null, that
could be a big problem.  sprintf(buf,"%s",NULL) on OSX produces
"(null)" but most sprintf()'s would probably crash instead.

The 'other' options (autopickup exceptions, menucolors, &c) were
not listed at all.  (I don't remember whether that was also the
case before the revamp.)  Now they're listed but not explained.

The 'msg_window' description was unhelpful; this replaces it.
A couple of others were longer than necessary so they've been
shortened.  The rest of optlist.h is reformatting wide lines.

Recently added 'safe_wait' option was included in the Guidebook
but not in dat/opthelp; add it.

dat/opthelp
doc/fixes37.0
include/optlist.h
src/options.c

index 5a9049cac48731564a064d3daa6cb4fc4a72b921..1bcf574740e917254368bc6e91614e647c5c7f87 100644 (file)
@@ -52,6 +52,8 @@ quick_farsight usually skip the chance to browse the map when     [FALSE]
 rawio          allow the use of raw I/O                           [FALSE]
 rest_on_space  count the space bar as a rest character            [FALSE]
 safe_pet       prevent you from (knowingly) attacking your pet(s) [TRUE]
+safe_wait      require use of 'm' prefix before '.' or 's' to     [TRUE]
+               wait or search when adjacent to a hostile monster
 sanity_check   perform data sanity checks                         [FALSE]
 showexp        display your accumulated experience points         [FALSE]
 showrace       show yourself by your race rather than by role     [FALSE]
index 9e712a19808c7ea0c8c167da09a59551be04315d..68e2814a929ad00dfb122f04d009302cdcc317c1 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.363 $ $NHDT-Date: 1606343573 2020/11/25 22:32:53 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.364 $ $NHDT-Date: 1606385979 2020/11/26 10:19:39 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -398,6 +398,9 @@ fire/frost horn feedback when zapped by monster was inaccurate (falsely
        claimed that it was "directed at self" when attacking hero)
 tins of spinach and 'dead' eggs could cause out of array bounds access
        attempting to index into mons[] by polyfodder() macro
+options help ('? g') listed all boolean options, then repeated them among
+       the compound options; on OSX they showed a description of "(null)"
+       but for other sprintf implementations they might cause a crash
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 5bc7ec31e5273f97385dbe1b1c51a0d276fcafba..06fb03f6abd7a9ca528809d422c0b631d984f3b8 100644 (file)
@@ -151,10 +151,10 @@ pfx_##a,
                 "the kinds of information to disclose at end of game")
     NHOPTC(dogname, PL_PSIZ, opt_in, set_gameview, No, Yes, No, No, NoAlias,
                 "the name of your (first) dog (e.g., dogname:Fang)")
-    NHOPTC(dungeon, MAXDCHARS + 1,opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "the symbols to use in drawing the dungeon map")
-    NHOPTC(effects, MAXECHARS + 1, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "the symbols to use in drawing special effects")
+    NHOPTC(dungeon, MAXDCHARS + 1,opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "the symbols to use in drawing the dungeon map")
+    NHOPTC(effects, MAXECHARS + 1, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "the symbols to use in drawing special effects")
     NHOPTB(eight_bit_tty, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
                 &iflags.wc_eight_bit_input)
     NHOPTB(extmenu, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
@@ -171,14 +171,14 @@ pfx_##a,
                 "the font to use in the message window")
     NHOPTC(font_size_map, 20, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
                 "the size of the map font")
-    NHOPTC(font_size_menu, 20, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
-                "the size of the menu font")
-    NHOPTC(font_size_message, 20, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
-                "the size of the message font")
-    NHOPTC(font_size_status, 20, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
-                "the size of the status font")
-    NHOPTC(font_size_text, 20, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
-                "the size of the text font")
+    NHOPTC(font_size_menu, 20, opt_in, set_gameview, Yes, Yes, Yes, No,
+                NoAlias, "the size of the menu font")
+    NHOPTC(font_size_message, 20, opt_in, set_gameview, Yes, Yes, Yes, No,
+                NoAlias, "the size of the message font")
+    NHOPTC(font_size_status, 20, opt_in, set_gameview, Yes, Yes, Yes, No,
+                NoAlias, "the size of the status font")
+    NHOPTC(font_size_text, 20, opt_in, set_gameview, Yes, Yes, Yes, No,
+                NoAlias, "the size of the text font")
     NHOPTC(font_status, 40, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
                 "the font to use in status window")
     NHOPTC(font_text, 40, opt_in, set_gameview, Yes, Yes, Yes, No, NoAlias,
@@ -214,7 +214,7 @@ pfx_##a,
     NHOPTB(hitpointbar, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
                 &iflags.wc2_hitpointbar)
     NHOPTC(horsename, PL_PSIZ, opt_in, set_gameview, No, Yes, No, No, NoAlias,
-                "the name of your (first) horse (e.g., horsename:Silver)")
+                "name of your (first) horse (e.g., horsename:Silver)")
 #ifdef BACKWARD_COMPAT
     NHOPTC(IBMgraphics, 70, opt_in, set_in_config, Yes, Yes, No, No, NoAlias,
                 "load IBMGraphics display symbols")
@@ -226,8 +226,8 @@ pfx_##a,
     NHOPTB(ignintr, 0, opt_in, set_in_config, Off, Yes, No, No, NoAlias,
                 (boolean *) 0)
 #endif
-    NHOPTB(implicit_uncursed, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
-                &flags.implicit_uncursed)
+    NHOPTB(implicit_uncursed, 0, opt_out, set_in_game, On, Yes, No, No,
+                NoAlias, &flags.implicit_uncursed)
     NHOPTB(large_font, 0, opt_in, set_in_config, Off, Yes, No, No, NoAlias,
                 &iflags.obsolete)
     NHOPTB(legacy, 0, opt_out, set_in_config, On, Yes, No, No, NoAlias,
@@ -248,18 +248,18 @@ pfx_##a,
                 &flags.mention_decor)
     NHOPTB(mention_walls, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
                 &flags.mention_walls)
-    NHOPTC(menu_deselect_all, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "deselect all items in a menu")
-    NHOPTC(menu_deselect_page, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "deselect all items on this page of a menu")
+    NHOPTC(menu_deselect_all, 4, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "deselect all items in a menu")
+    NHOPTC(menu_deselect_page, 4, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "deselect all items on this page of a menu")
     NHOPTC(menu_first_page, 4, opt_in, set_in_config, No, No, Yes, No, NoAlias,
                 "jump to the first page in a menu")
     NHOPTC(menu_headings, 4, opt_in, set_in_game, No, Yes, No, Yes, NoAlias,
                 "display style for menu headings")
     NHOPTC(menu_invert_all, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
                 "invert all items in a menu")
-    NHOPTC(menu_invert_page, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "invert all items on this page of a menu")
+    NHOPTC(menu_invert_page, 4, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "invert all items on this page of a menu")
     NHOPTC(menu_last_page, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
                 "jump to the last page in a menu")
     NHOPTC(menu_next_page, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
@@ -273,34 +273,34 @@ pfx_##a,
     NHOPTB(menu_overlay, 0, opt_in, set_in_config, Off, No, No, No, NoAlias,
                 (boolean *) 0)
 #endif
-    NHOPTC(menu_previous_page, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "goto the previous menu page")
+    NHOPTC(menu_previous_page, 4, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "goto the previous menu page")
     NHOPTC(menu_search, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
                 "search for a menu item")
     NHOPTC(menu_select_all, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
                 "select all items in a menu")
-    NHOPTC(menu_select_page, 4, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "select all items on this page of a menu")
+    NHOPTC(menu_select_page, 4, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "select all items on this page of a menu")
     NHOPTB(menu_tab_sep, 0, opt_in, set_wizonly, Off, Yes, No, No, NoAlias,
                 &iflags.menu_tab_sep)
     NHOPTB(menucolors, 0, opt_in, set_in_game, Off, Yes, Yes, No, NoAlias,
                 &iflags.use_menu_color)
     NHOPTC(menuinvertmode, 5, opt_in, set_in_game, No, Yes, No, No, NoAlias,
                 "behaviour of menu iverts")
-    NHOPTC(menustyle, MENUTYPELEN, opt_in, set_in_game, Yes, Yes, No, Yes, NoAlias,
-                "user interface for object selection")
+    NHOPTC(menustyle, MENUTYPELEN, opt_in, set_in_game, Yes, Yes, No, Yes,
+                NoAlias, "user interface for object selection")
     NHOPTB(monpolycontrol, 0, opt_in, set_wizonly, Off, Yes, No, No, NoAlias,
                 &iflags.mon_polycontrol)
-    NHOPTC(monsters, MAXMCLASSES, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "the symbols to use for monsters")
+    NHOPTC(monsters, MAXMCLASSES, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "the symbols to use for monsters")
     NHOPTC(mouse_support, 0, opt_in, set_in_game, No, Yes, No, No, NoAlias,
                 "game receives click info from mouse")
 #if defined(TTY_GRAPHICS) || defined(CURSES_GRAPHICS)
     NHOPTC(msg_window, 1, opt_in, set_in_game, Yes, Yes, No, Yes, NoAlias,
-                "the type of message window required")
+                "control of \"view previous message(s)\" (^P) behavior")
 #else
     NHOPTC(msg_window, 1, opt_in, set_in_config, Yes, Yes, No, Yes, NoAlias,
-                "the type of message window required")
+                "control of \"view previous message(s)\" (^P) behavior")
 #endif
     NHOPTC(msghistory, 5, opt_in, set_gameview, Yes, Yes, No, No, NoAlias,
                 "number of top line messages to save")
@@ -319,10 +319,10 @@ pfx_##a,
                 &flags.null)
     NHOPTC(number_pad, 1, opt_in, set_in_game, No, Yes, No, Yes, NoAlias,
                 "use the number pad for movement")
-    NHOPTC(objects, MAXOCLASSES, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "the symbols to use for objects")
-    NHOPTC(packorder, MAXOCLASSES, opt_in, set_in_game, No, Yes, No, No, NoAlias,
-                "the inventory order of the items in your pack")
+    NHOPTC(objects, MAXOCLASSES, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "the symbols to use for objects")
+    NHOPTC(packorder, MAXOCLASSES, opt_in, set_in_game, No, Yes, No, No,
+                NoAlias, "the inventory order of the items in your pack")
 #ifdef CHANGE_COLOR
 #ifndef WIN32
     NHOPTC(palette, 15, opt_in, set_in_game, No, Yes, No, No, "hicolor",
@@ -344,12 +344,12 @@ pfx_##a,
                 "maximum burden picked up before prompt")
     NHOPTB(pickup_thrown, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
                 &flags.pickup_thrown)
-    NHOPTC(pickup_types, MAXOCLASSES, opt_in, set_in_game, No, Yes, No, Yes, NoAlias, 
-                "types of objects to pick up automatically")
+    NHOPTC(pickup_types, MAXOCLASSES, opt_in, set_in_game, No, Yes, No, Yes,
+                NoAlias,  "types of objects to pick up automatically")
     NHOPTC(pile_limit, 24, opt_in, set_in_game, Yes, Yes, No, No, NoAlias,
                 "threshold for \"there are many objects here\"")
-    NHOPTC(player_selection, 12, opt_in, set_gameview, No, Yes, No, No, NoAlias,
-                "choose character via dialog or prompts")
+    NHOPTC(player_selection, 12, opt_in, set_gameview, No, Yes, No, No,
+                NoAlias, "choose character via dialog or prompts")
     NHOPTC(playmode, 8, opt_in, set_gameview, No, Yes, No, No, NoAlias,
                 "normal play, non-scoring explore mode, or debug mode")
     NHOPTB(popup_dialog, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
@@ -372,7 +372,7 @@ pfx_##a,
     NHOPTB(rest_on_space, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
                 &flags.rest_on_space)
     NHOPTC(roguesymset, 70, opt_in, set_in_game, No, Yes, No, Yes, NoAlias,
-                "load a set of rogue display symbols from the symbols file")
+                "load a set of rogue display symbols from symbols file")
     NHOPTC(role, PL_CSIZ, opt_in, set_gameview, No, Yes, No, No, "character",
                 "your starting role (e.g., Barbarian, Valkyrie)")
     NHOPTC(runmode, sizeof "teleport", opt_in, set_in_game, Yes, Yes, No, Yes,
@@ -434,7 +434,7 @@ pfx_##a,
     NHOPTC(suppress_alert, 8, opt_in, set_in_game, No, Yes, Yes, No, NoAlias,
                 "suppress alerts about version-specific features")
     NHOPTC(symset, 70, opt_in, set_in_game, No, Yes, No, Yes, NoAlias,
-                "load a set of display symbols from the symbols file")
+                "load a set of display symbols from symbols file")
     NHOPTC(term_cols, 6, opt_in, set_in_config, No, Yes, No, No, "termcolumns",
                 "number of columns")
     NHOPTC(term_rows, 6, opt_in, set_in_config, No, Yes, No, No, NoAlias,
@@ -460,8 +460,8 @@ pfx_##a,
                 &flags.tombstone)
     NHOPTB(toptenwin, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
                 &iflags.toptenwin)
-    NHOPTC(traps, MAXTCHARS + 1, opt_in, set_in_config, No, Yes, No, No, NoAlias,
-                "the symbols to use in drawing traps")
+    NHOPTC(traps, MAXTCHARS + 1, opt_in, set_in_config, No, Yes, No, No,
+                NoAlias, "the symbols to use in drawing traps")
     NHOPTB(travel, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
                 &flags.travelcmd)
 #ifdef DEBUG
@@ -484,8 +484,8 @@ pfx_##a,
                 "method of video updating")
 #endif
 #ifdef VIDEOSHADES
-    NHOPTC(videocolors, 40, opt_in, set_gameview, No, Yes, No, No, "videocolours",
-                "color mappings for internal screen routines")
+    NHOPTC(videocolors, 40, opt_in, set_gameview, No, Yes, No, No,
+                "videocolours", "color mappings for internal screen routines")
     NHOPTC(videoshades, 32, opt_in, set_gameview, No, Yes, No, No, NoAlias,
                 "gray shades to map to black/gray/white")
 #endif
@@ -527,8 +527,8 @@ pfx_##a,
 #endif
     NHOPTC(windowcolors, 80, opt_in, set_gameview, No, Yes, No, No, NoAlias,
                 "the foreground/background colors of windows")
-    NHOPTC(windowtype, WINTYPELEN, opt_in, set_gameview, No, Yes, No, No, NoAlias,
-                "windowing system to use")
+    NHOPTC(windowtype, WINTYPELEN, opt_in, set_gameview, No, Yes, No, No,
+                NoAlias, "windowing system to use")
     NHOPTB(wizweight, 0, opt_in, set_wizonly, Off, Yes, No, No, NoAlias,
                 &iflags.wizweight)
     NHOPTB(wraptext, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
index 1b946f29deb138a3b9ec32a256ae6c121fadb791..fab931033915b97f1397c950542df219bdd784da 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 options.c       $NHDT-Date: 1605618310 2020/11/17 13:05:10 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.480 $ */
+/* NetHack 3.7 options.c       $NHDT-Date: 1606385980 2020/11/26 10:19:40 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.481 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Michael Allison, 2008. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -5788,7 +5788,8 @@ int optidx;
     if (using_alias)
         Sprintf(buf, " (via alias: %s)", allopt[optidx].alias);
     config_error_add("%s option specified multiple times: %s%s",
-                     (allopt[optidx].opttyp == CompOpt) ? "compound" : "boolean",
+                     (allopt[optidx].opttyp == CompOpt) ? "compound"
+                                                        : "boolean",
                      allopt[optidx].name, buf);
 #endif /* ?MAC */
     return;
@@ -7400,8 +7401,7 @@ static struct other_opts {
     int NDECL((*othr_count_func));
 } othropt[] = {
     { "autopickup exceptions", set_in_game, OPT_OTHER_APEXC, count_apes },
-    { "status condition fields", set_in_game,
-      OPT_OTHER_COND, count_cond },
+    { "status condition fields", set_in_game, OPT_OTHER_COND, count_cond },
     { "menu colors", set_in_game, OPT_OTHER_MENUCOLOR, count_menucolors },
     { "message types", set_in_game, OPT_OTHER_MSGTYPE, msgtype_count },
 #ifdef STATUS_HILITES
@@ -8102,8 +8102,14 @@ static const char *opt_intro[] = {
 
 static const char *opt_epilog[] = {
     "",
-    "Some of the options can be set only before the game is started; those",
-    "items will not be selectable in the 'O' command's menu.",
+    "Some of the options can only be set before the game is started;",
+    "those items will not be selectable in the 'O' command's menu.",
+    "Some options are stored in a game's save file, and will keep saved",
+    "values when restoring that game even if you have updated your",
+    "config file to change them.  Such changes will matter for new games.",
+    "The \"other settings\" can be set with 'O', but when set within the",
+    "configuration file they use their own directives rather than OPTIONS.",
+    "See NetHack's \"Guidebook\" for details.",
     (char *) 0
 };
 
@@ -8135,15 +8141,44 @@ option_help()
     /* Compound options */
     putstr(datawin, 0, "Compound options:");
     for (i = 0; allopt[i].name; i++) {
+        if (allopt[i].opttyp != CompOpt) /* skip booleans */
+            continue;
         Sprintf(buf2, "`%s'", allopt[i].name);
         Sprintf(buf, "%-20s - %s%c", buf2, allopt[i].descr,
                 allopt[i + 1].name ? ',' : '.');
         putstr(datawin, 0, buf);
     }
+    putstr(datawin, 0, "");
+
+    putstr(datawin, 0, "Other settings:");
+    for (i = 0; othropt[i].name; ++i) {
+        Sprintf(buf, "`%s'", othropt[i].name);
+        putstr(datawin, 0, buf);
+    }
 
     for (i = 0; opt_epilog[i]; i++)
         putstr(datawin, 0, opt_epilog[i]);
 
+    /*
+     * TODO:
+     *  briefly describe interface-specific option-like settings for
+     *  the currently active interface:
+     *    X11 uses X-specific "application defaults" from NetHack.ad;
+     *    Qt has menu accessible "game -> Qt settings" (non-OSX) or
+     *      "nethack -> Preferences" (OSX) to maintain a few options
+     *      (font size, map tile size, paperdoll show/hide flag and
+     *      tile size) which persist across games;
+     *    Windows GUI also has some port-specific menus;
+     *    tty and curses: anything?
+     *  Best done via a new windowprocs function rather than plugging
+     *  in details here.
+     *
+     * Maybe:
+     *  switch from text window to pick-none menu so that user can
+     *  scroll back up.  (Not necessary for Qt where text windows are
+     *  already scrollable.)
+     */
+
     display_nhwindow(datawin, FALSE);
     destroy_nhwindow(datawin);
     return;