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:
@@ -22,7 +22,6 @@ static vms_handler_type FDECL(vms_handler, (genericptr_t,genericptr_t));
|
||||
#include <ssdef.h> /* system service status codes */
|
||||
#endif
|
||||
|
||||
static void NDECL(set_playmode);
|
||||
static void NDECL(wd_message);
|
||||
static boolean wiz_error_flag = FALSE;
|
||||
|
||||
@@ -435,26 +434,13 @@ port_help()
|
||||
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()
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
{
|
||||
if (wizard) {
|
||||
#ifdef WIZARD
|
||||
if (strcmpi(nh_getenv("USER"), WIZARD_NAME)) wizard = FALSE;
|
||||
#else
|
||||
wizard = FALSE;
|
||||
if (!strcmpi(nh_getenv("USER"), WIZARD_NAME)) return TRUE;
|
||||
#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 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user