OPTIONS=playmode:normal|explore|debug (trunk only)
[see cvs log for src/options.c for some additional info]
Relief for the command-line impaired. Allow player to request
explore or wizard mode via run-time config file or NETHACKOPTIONS.
Validation is left to xxxmain() and has been updated for Unix, VMS, and
ports which share pcmain. Mac and Be appear to allow any user to access
wizard mode, and may not need any modification, although they'll continue
to have the old buglet of running with both wizard and discover flags set
if player uses `nethack -X -D'. This may or may not work as-is for the
Qt interface depending upon whether it goes through one of the xxxmain()'s
mentioned above [someone needs to make sure that it doesn't allow Qt on
Unix to bypass the (username == WIZARD_NAME) test when user requests
wizard mode].
This commit is contained in:
@@ -202,6 +202,7 @@ objects like dungeon, but for object symbols
|
|||||||
default: ])[="(%!?+/$*`0_.
|
default: ])[="(%!?+/$*`0_.
|
||||||
pettype your preferred type of pet (cat or dog), if your character
|
pettype your preferred type of pet (cat or dog), if your character
|
||||||
class uses both types; or none for no pet [RANDOM]
|
class uses both types; or none for no pet [RANDOM]
|
||||||
|
playmode normal play or non-scoring explore mode or debug mode [normal]
|
||||||
race Your starting race (e.g., race:Human, race:Elf). [RANDOM]
|
race Your starting race (e.g., race:Human, race:Elf). [RANDOM]
|
||||||
role Your starting role (e.g., role:Barbarian, role:Valk).
|
role Your starting role (e.g., role:Barbarian, role:Valk).
|
||||||
Although you can specify just the first letter(s), it will
|
Although you can specify just the first letter(s), it will
|
||||||
|
|||||||
@@ -1983,6 +1983,15 @@ compile time option AUTOPICKUP_EXCEPTIONS included, you may be able to use
|
|||||||
configuration file lines to further refine
|
configuration file lines to further refine
|
||||||
.op autopickup
|
.op autopickup
|
||||||
behavior.
|
behavior.
|
||||||
|
.lp playmode
|
||||||
|
Values are `normal', `explore', or `debug'.
|
||||||
|
Allows selection of explore mode (also known as discovery mode) or debug
|
||||||
|
mode (also known as wizard mode) instead of normal play.
|
||||||
|
Debug mode might only be allowed for someone logged in under a particular
|
||||||
|
user name (on multi-user systems) or specifying a particular character
|
||||||
|
name (on single-user systems) or it might be disabled entirely. Requesting
|
||||||
|
it when not allowed or not possible results in explore mode instead.
|
||||||
|
Default is normal play.
|
||||||
.lp prayconfirm
|
.lp prayconfirm
|
||||||
Prompt for confirmation before praying (default on).
|
Prompt for confirmation before praying (default on).
|
||||||
.lp pushweapon
|
.lp pushweapon
|
||||||
|
|||||||
+11
-1
@@ -31,7 +31,7 @@
|
|||||||
\begin{document}
|
\begin{document}
|
||||||
%
|
%
|
||||||
% input file: guidebook.mn
|
% input file: guidebook.mn
|
||||||
% $Revision: 1.101 $ $Date: 2006/07/15 03:25:04 $
|
% $Revision: 1.102 $ $Date: 2007/02/14 01:44:46 $
|
||||||
%
|
%
|
||||||
%.ds h0 "
|
%.ds h0 "
|
||||||
%.ds h1 %.ds h2 \%
|
%.ds h1 %.ds h2 \%
|
||||||
@@ -2457,6 +2457,16 @@ compile time option AUTOPICKUP\_EXCEPTIONS included,
|
|||||||
you may be able to use ``{\it autopickup\_exception\/}'' configuration
|
you may be able to use ``{\it autopickup\_exception\/}'' configuration
|
||||||
file lines to further refine ``{\it autopickup\/}'' behavior.
|
file lines to further refine ``{\it autopickup\/}'' behavior.
|
||||||
%.lp
|
%.lp
|
||||||
|
\item[\ib{playmode}]
|
||||||
|
Values are {\it normal\/}, {\it explore\/}, or {\it debug\/}.
|
||||||
|
Allows selection of explore mode (also known as discovery mode) or debug
|
||||||
|
mode (also known as wizard mode) instead of normal play.
|
||||||
|
Debug mode might only be allowed for someone logged in under a particular
|
||||||
|
user name (on multi-user systems) or specifying a particular character
|
||||||
|
name (on single-user systems) or it might be disabled entirely. Requesting
|
||||||
|
it when not allowed or not possible results in explore mode instead.
|
||||||
|
Default is normal play.
|
||||||
|
%.lp
|
||||||
\item[\ib{prayconfirm}]
|
\item[\ib{prayconfirm}]
|
||||||
Prompt for confirmation before praying (default on).
|
Prompt for confirmation before praying (default on).
|
||||||
%.lp
|
%.lp
|
||||||
|
|||||||
@@ -282,6 +282,7 @@ all stackable weapons are capable of being thrown/shot for multi-shot volleys
|
|||||||
worm teeth and crysknives have become stackable
|
worm teeth and crysknives have become stackable
|
||||||
improved container interface
|
improved container interface
|
||||||
acid can destroy iron bars
|
acid can destroy iron bars
|
||||||
|
OPTIONS=playmode:normal|explore|debug to choose mode without command-line
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific New Features
|
Platform- and/or Interface-Specific New Features
|
||||||
|
|||||||
+37
-24
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)pcmain.c 3.5 2006/07/08 */
|
/* SCCS Id: @(#)pcmain.c 3.5 2007/02/14 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -66,6 +66,8 @@ extern int redirect_stdout; /* from sys/share/pcsys.c */
|
|||||||
extern void NDECL(mswin_destroy_reg);
|
extern void NDECL(mswin_destroy_reg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
STATIC_DCL void NDECL(set_playmode);
|
||||||
|
|
||||||
#ifdef EXEPATH
|
#ifdef EXEPATH
|
||||||
STATIC_DCL char *FDECL(exepath,(char *));
|
STATIC_DCL char *FDECL(exepath,(char *));
|
||||||
#endif
|
#endif
|
||||||
@@ -342,20 +344,7 @@ char *argv[];
|
|||||||
plnamesuffix(); /* strip suffix from name; calls askname() */
|
plnamesuffix(); /* strip suffix from name; calls askname() */
|
||||||
/* again if suffix was whole name */
|
/* again if suffix was whole name */
|
||||||
/* accepts any suffix */
|
/* accepts any suffix */
|
||||||
#ifdef WIZARD
|
set_playmode(); /* sets plname to "wizard" for wizard mode */
|
||||||
if (wizard) {
|
|
||||||
# ifdef KR1ED
|
|
||||||
if(!strcmp(plname, WIZARD_NAME))
|
|
||||||
# else
|
|
||||||
if(!strcmp(plname, WIZARD))
|
|
||||||
# endif
|
|
||||||
Strcpy(plname, "wizard");
|
|
||||||
else {
|
|
||||||
wizard = FALSE;
|
|
||||||
discover = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* WIZARD */
|
|
||||||
#if defined(PC_LOCKING)
|
#if defined(PC_LOCKING)
|
||||||
/* 3.3.0 added this to support detection of multiple games
|
/* 3.3.0 added this to support detection of multiple games
|
||||||
* under the same plname on the same machine in a windowed
|
* under the same plname on the same machine in a windowed
|
||||||
@@ -519,17 +508,10 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
#ifdef WIZARD
|
wizard = TRUE, discover = FALSE;
|
||||||
/* If they don't have a valid wizard name, it'll be
|
|
||||||
* changed to discover later. Cannot check for
|
|
||||||
* validity of the name right now--it might have a
|
|
||||||
* character class suffix, for instance.
|
|
||||||
*/
|
|
||||||
wizard = TRUE;
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case 'X':
|
case 'X':
|
||||||
discover = TRUE;
|
discover = TRUE, wizard = FALSE;
|
||||||
break;
|
break;
|
||||||
#ifdef NEWS
|
#ifdef NEWS
|
||||||
case 'n':
|
case 'n':
|
||||||
@@ -716,6 +698,37 @@ port_help()
|
|||||||
# endif /* MSDOS || WIN32 */
|
# endif /* MSDOS || WIN32 */
|
||||||
#endif /* PORT_HELP */
|
#endif /* PORT_HELP */
|
||||||
|
|
||||||
|
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string;
|
||||||
|
for usual config, WIZARD is the string; forcing WIZARD_NAME to match it
|
||||||
|
eliminates conditional testing for which one to use in string ops */
|
||||||
|
#ifndef KR1ED
|
||||||
|
# undef WIZARD_NAME
|
||||||
|
# define WIZARD_NAME WIZARD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* validate wizard mode if player has requested access to it */
|
||||||
|
STATIC_OVL void
|
||||||
|
set_playmode()
|
||||||
|
{
|
||||||
|
if (wizard) {
|
||||||
|
#ifdef WIZARD
|
||||||
|
if (strcmp(plname, WIZARD_NAME)) wizard = FALSE;
|
||||||
|
#else
|
||||||
|
wizard = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!wizard) {
|
||||||
|
discover = TRUE;
|
||||||
|
#ifdef WIZARD
|
||||||
|
} else {
|
||||||
|
discover = FALSE; /* paranoia */
|
||||||
|
Strcpy(plname, "wizard");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* don't need to do anything special for explore mode or normal play */
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef EXEPATH
|
#ifdef EXEPATH
|
||||||
# ifdef __DJGPP__
|
# ifdef __DJGPP__
|
||||||
#define PATH_SEPARATOR '/'
|
#define PATH_SEPARATOR '/'
|
||||||
|
|||||||
+67
-49
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)unixmain.c 3.5 2007/01/08 */
|
/* SCCS Id: @(#)unixmain.c 3.5 2007/02/14 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -39,10 +39,9 @@ extern void NDECL(check_linux_console);
|
|||||||
extern void NDECL(init_linux_cons);
|
extern void NDECL(init_linux_cons);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void NDECL(set_playmode);
|
||||||
static void NDECL(wd_message);
|
static void NDECL(wd_message);
|
||||||
#ifdef WIZARD
|
|
||||||
static boolean wiz_error_flag = FALSE;
|
static boolean wiz_error_flag = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc,argv)
|
main(argc,argv)
|
||||||
@@ -176,11 +175,9 @@ char *argv[];
|
|||||||
#ifdef MAIL
|
#ifdef MAIL
|
||||||
getmailstatus();
|
getmailstatus();
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIZARD
|
|
||||||
if (wizard)
|
/* wizard mode access is deferred until here */
|
||||||
Strcpy(plname, "wizard");
|
set_playmode(); /* sets plname to "wizard" for wizard mode */
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if(!*plname || !strncmp(plname, "player", 4)
|
if(!*plname || !strncmp(plname, "player", 4)
|
||||||
|| !strncmp(plname, "games", 4)) {
|
|| !strncmp(plname, "games", 4)) {
|
||||||
askname();
|
askname();
|
||||||
@@ -299,38 +296,10 @@ char *argv[];
|
|||||||
argc--;
|
argc--;
|
||||||
switch(argv[0][1]){
|
switch(argv[0][1]){
|
||||||
case 'D':
|
case 'D':
|
||||||
#ifdef WIZARD
|
wizard = TRUE, discover = FALSE;
|
||||||
{
|
break;
|
||||||
char *user;
|
|
||||||
int uid;
|
|
||||||
struct passwd *pw = (struct passwd *)0;
|
|
||||||
|
|
||||||
uid = getuid();
|
|
||||||
user = getlogin();
|
|
||||||
if (user) {
|
|
||||||
pw = getpwnam(user);
|
|
||||||
if (pw && (pw->pw_uid != uid)) pw = 0;
|
|
||||||
}
|
|
||||||
if (pw == 0) {
|
|
||||||
user = nh_getenv("USER");
|
|
||||||
if (user) {
|
|
||||||
pw = getpwnam(user);
|
|
||||||
if (pw && (pw->pw_uid != uid)) pw = 0;
|
|
||||||
}
|
|
||||||
if (pw == 0) {
|
|
||||||
pw = getpwuid(uid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pw && !strcmp(pw->pw_name,WIZARD)) {
|
|
||||||
wizard = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* otherwise fall thru to discover */
|
|
||||||
wiz_error_flag = TRUE;
|
|
||||||
#endif
|
|
||||||
case 'X':
|
case 'X':
|
||||||
discover = TRUE;
|
discover = TRUE, wizard = FALSE;
|
||||||
break;
|
break;
|
||||||
#ifdef NEWS
|
#ifdef NEWS
|
||||||
case 'n':
|
case 'n':
|
||||||
@@ -538,22 +507,71 @@ port_help()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string;
|
||||||
|
for usual config, WIZARD is the string; forcing WIZARD_NAME to match it
|
||||||
|
eliminates conditional testing for which one to use in string ops */
|
||||||
|
#ifndef KR1ED
|
||||||
|
# undef WIZARD_NAME
|
||||||
|
# define WIZARD_NAME WIZARD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* validate wizard mode if player has requested access to it */
|
||||||
|
static void
|
||||||
|
set_playmode()
|
||||||
|
{
|
||||||
|
if (wizard) {
|
||||||
|
#ifdef WIZARD
|
||||||
|
char *user;
|
||||||
|
int uid;
|
||||||
|
struct passwd *pw = (struct passwd *)0;
|
||||||
|
|
||||||
|
uid = getuid();
|
||||||
|
user = getlogin();
|
||||||
|
if (user) {
|
||||||
|
pw = getpwnam(user);
|
||||||
|
if (pw && (pw->pw_uid != uid)) pw = 0;
|
||||||
|
}
|
||||||
|
if (pw == 0) {
|
||||||
|
user = nh_getenv("USER");
|
||||||
|
if (user) {
|
||||||
|
pw = getpwnam(user);
|
||||||
|
if (pw && (pw->pw_uid != uid)) pw = 0;
|
||||||
|
}
|
||||||
|
if (pw == 0) {
|
||||||
|
pw = getpwuid(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!pw || strcmp(pw->pw_name, WIZARD_NAME)) wizard = FALSE;
|
||||||
|
#else /* !WIZARD */
|
||||||
|
wizard = FALSE;
|
||||||
|
#endif /* ?WIZARD */
|
||||||
|
|
||||||
|
if (!wizard) {
|
||||||
|
discover = wiz_error_flag = TRUE;
|
||||||
|
#ifdef WIZARD
|
||||||
|
} else {
|
||||||
|
discover = FALSE; /* paranoia */
|
||||||
|
Strcpy(plname, "wizard");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* don't need to do anything special for explore mode or normal play */
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wd_message()
|
wd_message()
|
||||||
{
|
{
|
||||||
#ifdef WIZARD
|
|
||||||
if (wiz_error_flag) {
|
if (wiz_error_flag) {
|
||||||
|
#ifdef WIZARD
|
||||||
pline("Only user \"%s\" may access debug (wizard) mode.",
|
pline("Only user \"%s\" may access debug (wizard) mode.",
|
||||||
# ifndef KR1ED
|
WIZARD_NAME);
|
||||||
WIZARD);
|
#else
|
||||||
# else
|
pline("Debug mode is not available.");
|
||||||
WIZARD_NAME);
|
|
||||||
# endif
|
|
||||||
pline("Entering discovery mode instead.");
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
if (discover)
|
pline("Entering explore/discovery mode instead.");
|
||||||
You("are in non-scoring discovery mode.");
|
wizard = 0, discover = 1; /* (paranoia) */
|
||||||
|
} else if (discover)
|
||||||
|
You("are in non-scoring explore/discovery mode.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+42
-23
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)vmsmain.c 3.5 2006/04/01 */
|
/* SCCS Id: @(#)vmsmain.c 3.5 2007/02/14 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
/* main.c - VMS NetHack */
|
/* main.c - VMS NetHack */
|
||||||
@@ -22,10 +22,9 @@ static vms_handler_type FDECL(vms_handler, (genericptr_t,genericptr_t));
|
|||||||
#include <ssdef.h> /* system service status codes */
|
#include <ssdef.h> /* system service status codes */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void NDECL(set_playmode);
|
||||||
static void NDECL(wd_message);
|
static void NDECL(wd_message);
|
||||||
#ifdef WIZARD
|
|
||||||
static boolean wiz_error_flag = FALSE;
|
static boolean wiz_error_flag = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc,argv)
|
main(argc,argv)
|
||||||
@@ -126,11 +125,8 @@ char *argv[];
|
|||||||
|
|
||||||
process_options(argc, argv); /* command line options */
|
process_options(argc, argv); /* command line options */
|
||||||
|
|
||||||
#ifdef WIZARD
|
/* wizard mode access is deferred until here */
|
||||||
if (wizard)
|
set_playmode(); /* sets plname to "wizard" for wizard mode */
|
||||||
Strcpy(plname, "wizard");
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (!*plname || !strncmpi(plname, "games", 4) ||
|
if (!*plname || !strncmpi(plname, "games", 4) ||
|
||||||
!strcmpi(plname, "nethack"))
|
!strcmpi(plname, "nethack"))
|
||||||
askname();
|
askname();
|
||||||
@@ -239,17 +235,11 @@ char *argv[];
|
|||||||
argc--;
|
argc--;
|
||||||
switch(argv[0][1]){
|
switch(argv[0][1]){
|
||||||
case 'D':
|
case 'D':
|
||||||
#ifdef WIZARD
|
wizard = TRUE, discover = FALSE;
|
||||||
if(!strcmpi(nh_getenv("USER"), WIZARD_NAME)) {
|
break;
|
||||||
wizard = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* otherwise fall thru to discover */
|
|
||||||
wiz_error_flag = TRUE;
|
|
||||||
#endif /* WIZARD */
|
|
||||||
case 'X':
|
case 'X':
|
||||||
case 'x':
|
case 'x':
|
||||||
discover = TRUE;
|
discover = TRUE, wizard = FALSE;
|
||||||
break;
|
break;
|
||||||
#ifdef NEWS
|
#ifdef NEWS
|
||||||
case 'n':
|
case 'n':
|
||||||
@@ -449,18 +439,47 @@ port_help()
|
|||||||
}
|
}
|
||||||
#endif /* PORT_HELP */
|
#endif /* PORT_HELP */
|
||||||
|
|
||||||
|
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string;
|
||||||
|
for usual config, WIZARD is the string and vmsconf.h forces WIZARD_NAME
|
||||||
|
to match it, avoiding need to test which one to use in string ops */
|
||||||
|
|
||||||
|
/* validate wizard mode if player has requested access to it */
|
||||||
|
static void
|
||||||
|
set_playmode()
|
||||||
|
{
|
||||||
|
if (wizard) {
|
||||||
|
#ifdef WIZARD
|
||||||
|
if (strcmpi(nh_getenv("USER"), WIZARD_NAME)) wizard = FALSE;
|
||||||
|
#else
|
||||||
|
wizard = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!wizard) {
|
||||||
|
discover = wiz_error_flag = TRUE;
|
||||||
|
#ifdef WIZARD
|
||||||
|
} else {
|
||||||
|
discover = FALSE; /* paranoia */
|
||||||
|
Strcpy(plname, "wizard");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* don't need to do anything special for explore mode or normal play */
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wd_message()
|
wd_message()
|
||||||
{
|
{
|
||||||
#ifdef WIZARD
|
|
||||||
if (wiz_error_flag) {
|
if (wiz_error_flag) {
|
||||||
|
#ifdef WIZARD
|
||||||
pline("Only user \"%s\" may access debug (wizard) mode.",
|
pline("Only user \"%s\" may access debug (wizard) mode.",
|
||||||
WIZARD_NAME);
|
WIZARD_NAME);
|
||||||
pline("Entering discovery mode instead.");
|
#else
|
||||||
} else
|
pline("Debug mode is not available.");
|
||||||
#endif
|
#endif
|
||||||
if (discover)
|
pline("Entering explore/discovery mode instead.");
|
||||||
You("are in non-scoring discovery mode.");
|
wizard = 0, discover = 1; /* (paranoia) */
|
||||||
|
} else if (discover)
|
||||||
|
You("are in non-scoring explore/discovery mode.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*vmsmain.c*/
|
/*vmsmain.c*/
|
||||||
|
|||||||
Reference in New Issue
Block a user