options help
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user