From: Pasi Kallinen Date: Tue, 31 Mar 2015 15:14:10 +0000 (+0300) Subject: Allow admin to disable explore mode X-Git-Tag: NetHack-3.6.0_RC01~496^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca80675d590cbffcb9abd4a79bf01ceb97eef0b3;p=nethack Allow admin to disable explore mode Some public servers want to disable explore mode, so make it configurable in sysconf. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index df7301a81..4293fdb3e 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -2922,6 +2922,10 @@ SHELLERS A list of users who are allowed to use the shell escape command (!). The syntax is the same as WIZARDS. .lp +EXPLORERS +A list of users who are allowed to use the explore mode. The +syntax is the same as WIZARDS. +.lp MAXPLAYERS Limit the maximum number of games that can be running at the same time. .lp diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 7c2464664..5f1ae5e4b 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -3494,6 +3494,10 @@ asterisk (*) allows anyone to start a game in wizard mode. A list of users who are allowed to use the shell escape command (!). The syntax is the same as WIZARDS. %.lp +\item[\ib{EXPLORERS}] +A list of users who are allowed to use the explore mode. +The syntax is the same as WIZARDS. +%.lp \item[\ib{MAXPLAYERS}] Limit the maximum number of games taht can be running at the same time. %.lp diff --git a/include/sys.h b/include/sys.h index b97f7ca80..84d42b5b6 100644 --- a/include/sys.h +++ b/include/sys.h @@ -10,6 +10,7 @@ struct sysopt { char *support; /* local support contact */ char *recover; /* how to run recover - may be overridden by win port */ char *wizards; + char *explorers; char *shellers; /* like wizards, for ! command (-DSHELL) */ char *debugfiles; /* files to show debugplines in. '*' is all. */ int env_dbgfl; /* 1: debugfiles comes from getenv("DEBUGFILES") diff --git a/src/cmd.c b/src/cmd.c index 8b7408533..b028c57a3 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -509,6 +509,14 @@ enter_explore_mode(VOID_ARGS) } else if (discover) { You("are already in explore mode."); } else { +#ifdef SYSCF + if (!sysopt.explorers || + !sysopt.explorers[0] || + !check_user_string(sysopt.explorers)) { + You("cannot access explore mode."); + return 0; + } +#endif pline( "Beware! From explore mode there will be no return to normal game."); if (paranoid_query(ParanoidQuit, diff --git a/src/files.c b/src/files.c index ace417e7d..179cd3437 100644 --- a/src/files.c +++ b/src/files.c @@ -2184,6 +2184,9 @@ int src; } else if (src == SET_IN_SYS && match_varname(buf, "SHELLERS", 8)) { if (sysopt.shellers) free(sysopt.shellers); sysopt.shellers = dupstr(bufp); + } else if (src == SET_IN_SYS && match_varname(buf, "EXPLORERS", 7)) { + if (sysopt.explorers) free(sysopt.explorers); + sysopt.explorers = dupstr(bufp); } else if (src == SET_IN_SYS && match_varname(buf, "DEBUGFILES", 5)) { if (sysopt.debugfiles) free(sysopt.debugfiles); /* if showdebug() has already been called (perhaps we've added diff --git a/src/sys.c b/src/sys.c index 35e46b7c8..6ca0017f7 100644 --- a/src/sys.c +++ b/src/sys.c @@ -33,6 +33,7 @@ sys_early_init() #endif sysopt.env_dbgfl = 0; /* haven't checked getenv("DEBUGFILES") yet */ sysopt.shellers = NULL; + sysopt.explorers = NULL; sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */ /* record file */ diff --git a/sys/unix/sysconf b/sys/unix/sysconf index cff28b04f..50fa74085 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -14,6 +14,9 @@ WIZARDS=root games # Uses the same syntax as the WIZARDS option above. #SHELLERS= +# Users allowed to use #exploremode. Same syntax as WIZARDS above. +EXPLORERS=* + # Show debugging information originating from these source files. # Use '*' for all, or list source files separated by spaces. # Only available if game has been compiled with DEBUG. diff --git a/sys/winnt/sysconf b/sys/winnt/sysconf index 67c0b814d..808546da8 100644 --- a/sys/winnt/sysconf +++ b/sys/winnt/sysconf @@ -14,6 +14,9 @@ WIZARDS=* # Uses the same syntax as the WIZARDS option above. #SHELLERS= +# Users allowed to use #exploremode. Same syntax as WIZARDS above. +EXPLORERS=* + # Show debugging information originating from these source files. # Use '*' for all, or list source files separated by spaces. # Only available if game has been compiled with DEBUG.