yet more wizard mode handling (trunk only)
Reorganize the recent wizard mode control: move set_playmode() from
xxxmain.c to the core, and have it call new authorize_wizard_mode() to do
the port-specific part. If the set_playmode() call during startup doesn't
result in running in wizard mode (either because not allowed or user
didn't request it), it will be called again during restore if the save
file is from a wizard mode game.
For ports which check character name for authorization, players will
have to use `nethack -u whatever -D' (or options for name and playmode) to
restore a wizard mode save file if WIZARD has been changed from "wizard".
plname[] from a wizard mode saved game will always have that value, so if
it's not the right one players will need to get authorized by the startup
code before loading the save file.
This commit is contained in:
@@ -4485,6 +4485,26 @@ char *op;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* set up for wizard mode if player or save file has requested to it;
|
||||
called from port-specific startup code to handle `nethack -D' or
|
||||
OPTIONS=playmode:debug, or from dorecover()'s restgamestate() if
|
||||
restoring a game which was saved in wizard mode */
|
||||
void
|
||||
set_playmode()
|
||||
{
|
||||
if (wizard) {
|
||||
#ifdef WIZARD
|
||||
if (authorize_wizard_mode())
|
||||
Strcpy(plname, "wizard");
|
||||
else
|
||||
#endif
|
||||
wizard = FALSE; /* not allowed or not available */
|
||||
/* force explore mode if we didn't make it into wizard mode */
|
||||
discover = !wizard;
|
||||
}
|
||||
/* don't need to do anything special for explore mode or normal play */
|
||||
}
|
||||
|
||||
#endif /* OPTION_LISTS_ONLY */
|
||||
|
||||
/*options.c*/
|
||||
|
||||
@@ -546,13 +546,12 @@ unsigned int *stuckid, *steedid; /* STEED */
|
||||
/* wizard and discover are actually flags.debug and flags.explore;
|
||||
player might be overriding the save file values for them */
|
||||
if (newgameflags.explore) discover = TRUE;
|
||||
if (newgameflags.debug) wizard = TRUE;
|
||||
if (wizard) {
|
||||
#ifdef WIZARD
|
||||
discover = FALSE;
|
||||
#else
|
||||
discover = TRUE, wizard = FALSE;
|
||||
#endif
|
||||
if (newgameflags.debug) {
|
||||
/* authorized by startup code; wizard mode exists and is allowed */
|
||||
wizard = TRUE, discover = FALSE;
|
||||
} else if (wizard) {
|
||||
/* specified by save file; check authorization now */
|
||||
set_playmode();
|
||||
}
|
||||
#ifdef SYSFLAGS
|
||||
newgamesysflags = sysflags;
|
||||
|
||||
Reference in New Issue
Block a user