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:
@@ -66,8 +66,6 @@ extern int redirect_stdout; /* from sys/share/pcsys.c */
|
||||
extern void NDECL(mswin_destroy_reg);
|
||||
#endif
|
||||
|
||||
STATIC_DCL void NDECL(set_playmode);
|
||||
|
||||
#ifdef EXEPATH
|
||||
STATIC_DCL char *FDECL(exepath,(char *));
|
||||
#endif
|
||||
@@ -697,26 +695,13 @@ port_help()
|
||||
#endif
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
STATIC_OVL void
|
||||
set_playmode()
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
{
|
||||
if (wizard) {
|
||||
#ifdef WIZARD
|
||||
if (strcmp(plname, WIZARD_NAME)) wizard = FALSE;
|
||||
#else
|
||||
wizard = FALSE;
|
||||
if (!strcmp(plname, WIZARD_NAME)) return TRUE;
|
||||
#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 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef EXEPATH
|
||||
|
||||
Reference in New Issue
Block a user