Make WIZARD unconditional.

This commit is contained in:
Sean Hunt
2015-02-14 00:31:17 -05:00
committed by Pasi Kallinen
parent eca41ae060
commit cc7ab4a2da
62 changed files with 42 additions and 493 deletions

View File

@@ -161,10 +161,8 @@ static void process_options(int argc, char **argv)
argc--;
switch (argv[0][1]) {
case 'D':
#ifdef WIZARD
wizard = TRUE, discover = FALSE;
break;
#endif
/* otherwise fall thru to discover */
case 'X':
discover = TRUE, wizard = FALSE;
@@ -253,12 +251,8 @@ void getlock(void)
boolean
authorize_wizard_mode()
{
#ifdef WIZARD
/* other ports validate user name or character name here */
return TRUE;
#else
return FALSE;
#endif
}
#ifndef __begui__

View File

@@ -284,12 +284,8 @@ finder_file_request(void)
boolean
authorize_wizard_mode()
{
#ifdef WIZARD
/* other ports validate user name or character name here */
return TRUE;
#else
return FALSE;
#endif
}
/*macmain.c*/

View File

@@ -619,9 +619,7 @@ void mac_askname ()
fatal("\pCannot create mode menu");
AppendMenu(askmenu[RSRC_ASK_MODE], "\pNormal");
AppendMenu(askmenu[RSRC_ASK_MODE], "\pExplore");
#ifdef WIZARD
AppendMenu(askmenu[RSRC_ASK_MODE], "\pDebug");
#endif
InsertMenu(askmenu[RSRC_ASK_MODE], hierMenu);
currmode = 0;
@@ -708,9 +706,7 @@ void mac_askname ()
/* Adjust the mode popup menu */
CheckMenuItem(askmenu[RSRC_ASK_MODE], 1, currmode == 0);
CheckMenuItem(askmenu[RSRC_ASK_MODE], 2, currmode == 1);
#ifdef WIZARD
CheckMenuItem(askmenu[RSRC_ASK_MODE], 3, currmode == 2);
#endif
/* Wait for an action on an item */
ModalDialog(filter, &item);
@@ -773,22 +769,17 @@ void mac_askname ()
DisposeUserItemUPP(redraw);
/* Process the mode */
#ifdef WIZARD
wizard =
#endif
discover = 0;
wizard = discover = 0;
switch (currmode) {
case 0: /* Normal */
break;
case 1: /* Explore */
discover = 1;
break;
#ifdef WIZARD
case 2: /* Debug */
wizard = 1;
strcpy(plname, WIZARD);
strcpy(plname, WIZARD_NAME);
break;
#endif
default: /* Quit */
ExitToShell();
}
@@ -935,7 +926,6 @@ AdjustMenus(short dimMenubar)
if (newMenubar != mbarRegular)
; /* we've already found its state */
#ifdef WIZARD
else if (wizard)
{
newMenubar = mbarSpecial;
@@ -947,7 +937,6 @@ AdjustMenus(short dimMenubar)
SetMenuItemText(MHND_FILE, menuFilePlayMode, "\pDebug");
}
}
#endif
else if (discover)
{

View File

@@ -702,21 +702,11 @@ port_help()
# endif /* MSDOS || WIN32 */
#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 */
boolean
authorize_wizard_mode()
{
#ifdef WIZARD
if (!strcmp(plname, WIZARD_NAME)) return TRUE;
#endif
return FALSE;
}

View File

@@ -224,13 +224,10 @@ char *argv[];
or holds a generic user name like "player" or "games" */
plnamesuffix();
#ifdef WIZARD
if (wizard) {
/* use character name rather than lock letter for file names */
locknum = 0;
} else
#endif
{
} else {
/* suppress interrupts while processing lock file */
(void) signal(SIGQUIT,SIG_IGN);
(void) signal(SIGINT,SIG_IGN);
@@ -560,12 +557,10 @@ port_help()
boolean
authorize_wizard_mode()
{
#ifdef WIZARD
struct passwd *pw = get_unix_pw();
if (pw && sysopt.wizards && sysopt.wizards[0]) {
if(check_user_string(sysopt.wizards)) return TRUE;
}
#endif /* WIZARD */
wiz_error_flag = TRUE; /* not being allowed into wizard mode */
return FALSE;
}
@@ -574,16 +569,12 @@ static void
wd_message()
{
if (wiz_error_flag) {
#ifdef WIZARD
if (sysopt.wizards && sysopt.wizards[0]) {
char *tmp = build_english_list(sysopt.wizards);
pline("Only user%s %s may access debug (wizard) mode.",
index(sysopt.wizards, ' ')?"s":"", tmp);
free(tmp);
} else
#else
pline("Debug mode is not available.");
#endif
pline("Entering explore/discovery mode instead.");
wizard = 0, discover = 1; /* (paranoia) */
} else if (discover)

View File

@@ -311,9 +311,7 @@ int wt;
#endif
#ifndef NO_SIGNAL
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
# ifdef WIZARD
if(wizard) (void) signal(SIGQUIT,SIG_DFL);
# endif
#endif
if(wt) {
raw_print("");

View File

@@ -136,13 +136,10 @@ char *argv[];
or holds a generic user name like "player" or "games" */
plnamesuffix();
#ifdef WIZARD
if (wizard) {
/* use character name rather than lock letter for file names */
locknum = 0;
} else
#endif
{
} else {
/* suppress interrupts while processing lock file */
(void) signal(SIGQUIT, SIG_IGN);
(void) signal(SIGINT, SIG_IGN);
@@ -416,12 +413,10 @@ genericptr_t sigargs, mechargs; /* [0] is argc, [1..argc] are the real args */
|| (condition >= SS$_ASTFLT && condition <= SS$_TBIT)
|| (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) {
program_state.done_hup = TRUE; /* pretend hangup has been attempted */
# if defined(WIZARD) && !defined(BETA)
# ifndef BETA
if (wizard)
# endif /*WIZARD && !BETA*/
# if defined(WIZARD) || defined(BETA)
# endif /* !BETA */
abort(); /* enter the debugger */
# endif /*WIZARD || BETA*/
}
return SS$_RESIGNAL;
}
@@ -454,9 +449,7 @@ port_help()
boolean
authorize_wizard_mode()
{
#ifdef WIZARD
if (!strcmpi(nh_getenv("USER"), WIZARD_NAME)) return TRUE;
#endif
wiz_error_flag = TRUE; /* not being allowed into wizard mode */
return FALSE;
}
@@ -465,12 +458,8 @@ static void
wd_message()
{
if (wiz_error_flag) {
#ifdef WIZARD
pline("Only user \"%s\" may access debug (wizard) mode.",
WIZARD_NAME);
#else
pline("Debug mode is not available.");
#endif
pline("Entering explore/discovery mode instead.");
wizard = 0, discover = 1; /* (paranoia) */
} else if (discover)

View File

@@ -367,9 +367,7 @@ hack_resume(screen_manip)
boolean screen_manip;
{
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
# ifdef WIZARD
if (wizard) (void) signal(SIGQUIT,SIG_DFL);
# endif
if (screen_manip)
resume_nhwindows(); /* setup terminal modes, redraw screen, &c */
}

View File

@@ -296,7 +296,6 @@ NHCmdPadCell cells_layout_lookup[NH_CMDPAD_CELLNUM] =
{ -1, "X", "X", 13, NH_CELL_LAYOUT_MENU, 1 , 0 }
};
#ifdef WIZARD
/* wizard mode layout */
NHCmdPadCell cells_layout_wizard[NH_CMDPAD_CELLNUM] =
{
@@ -313,7 +312,6 @@ NHCmdPadCell cells_layout_wizard[NH_CMDPAD_CELLNUM] =
{ -1, "", "", -NH_CMDPAD_FONT_NORMAL, NH_CELL_REG, 1, (void*)-1 },
{ -1, "X", "X", 13, NH_CELL_LAYOUT_MENU, 1 , 0 }
};
#endif
#else /* !WIN_CE_SMARTPHONE */
@@ -557,13 +555,11 @@ void register_command_window_class()
nhcmdlayout_init(plt, cells_layout_lookup);
nhcmdset_add(nhcmdset_current, plt);
#ifdef WIZARD
if( wizard ) {
plt = nhcmdlayout_create("Wizard Mode", NH_CMDPAD_ROWS, NH_CMDPAD_COLS);
nhcmdlayout_init(plt, cells_layout_wizard);
nhcmdset_add(nhcmdset_current, plt);
}
#endif
#else /* ! WIN_CE_SMARTPHONE */
plt = nhcmdlayout_create("lowercase", NH_CMDPAD_ROWS, NH_CMDPAD_COLS);

View File

@@ -340,10 +340,8 @@ register char *s;
void win32_abort()
{
#ifdef WIZARD
if (wizard)
DebugBreak();
#endif
abort();
}

View File

@@ -417,7 +417,7 @@ int *x, *y, *mod;
static void
really_move_cursor()
{
#if defined(PORT_DEBUG) && defined(WIZARD)
#ifdef PORT_DEBUG
char oldtitle[BUFSZ], newtitle[BUFSZ];
if (display_cursor_info && wizard) {
oldtitle[0] = '\0';

View File

@@ -236,7 +236,6 @@ extern void NDECL(backsp);
void win32_abort()
{
#ifdef WIZARD
if (wizard) {
# ifdef WIN32CON
int c, ci, ct;
@@ -263,7 +262,6 @@ void win32_abort()
DebugBreak();
# endif
}
#endif
abort();
}