control of command-line usage entry in '?' menu
Instead of using a compile-time macro to suppress inclusion of the menu entry to show UNIX command-line usage in the help menu, use a sysconf setting instead. Default is HIDEUSAGE=0, to include the entry for command-line usage. Set HIDEUSAGE=1 to exclude that. Does not affect 'nethack --usage' if player actually has access to the command-line.
This commit is contained in:
@@ -69,8 +69,8 @@ nethack --windowtype:Iii
|
||||
nethack -n
|
||||
don't show the 'news' file is one is present in nethack's directory.
|
||||
|
||||
nethack --nethackrc:File
|
||||
use File instead of the default run-time configuration file (which is
|
||||
nethack --nethackrc:RC-file
|
||||
use RC-file instead of the default run-time configuration file (which is
|
||||
usually '~/.nethackrc'); the file name should include full path unless
|
||||
located in nethack's directory;
|
||||
nethack --no-nethackrc
|
||||
|
||||
@@ -5765,6 +5765,9 @@ POINTSMIN\ =\ Minimum number of points to get an entry in the score file.
|
||||
PERS_IS_UID\ =\ 0 or 1 to use user names or numeric userids, respectively,
|
||||
to identify unique people for the score file.
|
||||
.lp
|
||||
HIDEUSAGE\ =\ 0 or 1 to control whether the help menu entry for command
|
||||
line usage is shown or suppressed.
|
||||
.lp
|
||||
MAX_STATUENAME_RANK\ =\ Maximum number of score file entries to use for
|
||||
random statue names (default is 10).
|
||||
.lp
|
||||
|
||||
@@ -6371,6 +6371,10 @@ Minimum number of points to get an entry in the score file.
|
||||
0 or 1 to use user names or numeric userids, respectively, to identify
|
||||
unique people for the score file.
|
||||
%.lp
|
||||
\item[\ib{HIDEUSAGE}]
|
||||
0 or 1 to control whether the help menu entry for command
|
||||
line usage is shown or suppressed.
|
||||
%.lp
|
||||
\item[\ib{MAX\verb+_+STATUENAME\verb+_+RANK}]
|
||||
Maximum number of score file entries to use for
|
||||
random statue names (default is 10).
|
||||
|
||||
@@ -202,6 +202,9 @@
|
||||
* PERS_IS_UID (0 or 1 - person is name or (numeric) userid)
|
||||
* Can force incubi/succubi behavior to be toned down to nymph-like:
|
||||
* SEDUCE (0 or 1 - runtime disable/enable SEDUCE option)
|
||||
* Can hide the entry for displaying command line usage from
|
||||
* the help menu if players don't have access to command lines:
|
||||
* HIDEUSAGE (0 or 1 - runtime show/hide command line usage)
|
||||
* The following options pertain to crash reporting:
|
||||
* GREPPATH (the path to the system grep(1) utility)
|
||||
* GDBPATH (the path to the system gdb(1) program)
|
||||
@@ -421,14 +424,6 @@
|
||||
*/
|
||||
#endif /* CHDIR */
|
||||
|
||||
/*
|
||||
* Define HIDE_USAGE to keep the "description of command line" out of
|
||||
* the help menu if players have no access to a command line or if that
|
||||
* is radically different from the description for UNIX in dat/usagehlp
|
||||
* (a better solution for that would be a separate file and different
|
||||
* value for USAGEHELP in global.h).
|
||||
*/
|
||||
/* #define HIDE_USAGE */ /* */
|
||||
|
||||
/*
|
||||
* Section 3: Definitions that may vary with system type.
|
||||
|
||||
@@ -50,8 +50,12 @@ struct sysopt {
|
||||
/* enable accessibility options */
|
||||
int accessibility;
|
||||
#ifdef WIN32
|
||||
int portable_device_paths; /* nethack configuration for a portable device */
|
||||
int portable_device_paths; /* nethack config for a portable device */
|
||||
#endif
|
||||
|
||||
/* nethack's interactive help menu */
|
||||
int hideusage; /* 0: include 'command-line usage' entry in help menu;
|
||||
* 1: suppress it */
|
||||
};
|
||||
|
||||
extern struct sysopt sysopt;
|
||||
|
||||
@@ -2577,6 +2577,9 @@ parse_config_line(char *origbuf)
|
||||
}
|
||||
sysopt.seduce = n;
|
||||
sysopt_seduce_set(sysopt.seduce);
|
||||
} else if (in_sysconf && match_varname(buf, "HIDEUSAGE", 9)) {
|
||||
n = !!atoi(bufp);
|
||||
sysopt.hideusage = n;
|
||||
} else if (in_sysconf && match_varname(buf, "MAXPLAYERS", 10)) {
|
||||
n = atoi(bufp);
|
||||
/* XXX to get more than 25, need to rewrite all lock code */
|
||||
|
||||
@@ -32,9 +32,7 @@ static void dispfile_optionfile(void);
|
||||
static void dispfile_optmenu(void);
|
||||
static void dispfile_license(void);
|
||||
static void dispfile_debughelp(void);
|
||||
#ifndef HIDE_USAGE
|
||||
static void dispfile_usagehelp(void);
|
||||
#endif
|
||||
static void hmenu_doextversion(void);
|
||||
static void hmenu_dohistory(void);
|
||||
static void hmenu_dowhatis(void);
|
||||
@@ -2358,13 +2356,11 @@ dispfile_debughelp(void)
|
||||
display_file(DEBUGHELP, TRUE);
|
||||
}
|
||||
|
||||
#ifndef HIDE_USAGE
|
||||
static void
|
||||
dispfile_usagehelp(void)
|
||||
{
|
||||
display_file(USAGEHELP, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
hmenu_doextversion(void)
|
||||
@@ -2423,9 +2419,7 @@ static const struct {
|
||||
{ dokeylist, "Full list of keyboard commands." },
|
||||
{ hmenu_doextlist, "List of extended commands." },
|
||||
{ domenucontrols, "List menu control keys." },
|
||||
#ifndef HIDE_USAGE
|
||||
{ dispfile_usagehelp, "Description of NetHack's command line." },
|
||||
#endif
|
||||
{ dispfile_license, "The NetHack license." },
|
||||
{ docontact, "Support information." },
|
||||
#ifdef PORT_HELP
|
||||
@@ -2455,6 +2449,9 @@ dohelp(void)
|
||||
for (i = 0; help_menu_items[i].text; i++) {
|
||||
if (!wizard && help_menu_items[i].f == dispfile_debughelp)
|
||||
continue;
|
||||
if (sysopt.hideusage && help_menu_items[i].f == dispfile_usagehelp)
|
||||
continue;
|
||||
|
||||
if (help_menu_items[i].text[0] == '%') {
|
||||
Sprintf(helpbuf, help_menu_items[i].text, PORT_ID);
|
||||
} else if (help_menu_items[i].f == dispfile_optmenu) {
|
||||
|
||||
@@ -81,6 +81,10 @@ sys_early_init(void)
|
||||
#ifdef WIN32
|
||||
sysopt.portable_device_paths = 0;
|
||||
#endif
|
||||
|
||||
/* help menu */
|
||||
sysopt.hideusage = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,11 @@ MAXPLAYERS=10
|
||||
# numeric (1) user id.
|
||||
#PERS_IS_UID=1
|
||||
|
||||
# Help menu control; 0 - include "command line usage" entry in help menu;
|
||||
# 1 - suppress it from the menu. Does not affect 'nethack --usage' when
|
||||
# player has access to the command line.
|
||||
#HIDEUSAGE=0
|
||||
|
||||
# Maximum number of score file entries to use for random statue names
|
||||
#MAX_STATUENAME_RANK=10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user