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:
@@ -24,8 +24,6 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
static void NDECL(set_playmode);
|
||||
|
||||
static void finder_file_request(void);
|
||||
int main(void);
|
||||
|
||||
@@ -271,26 +269,15 @@ finder_file_request(void)
|
||||
}
|
||||
|
||||
/* validate wizard mode if player has requested access to it */
|
||||
static void
|
||||
set_playmode()
|
||||
boolean
|
||||
authorize_wizard_mode()
|
||||
{
|
||||
if (wizard) {
|
||||
#ifdef WIZARD
|
||||
/* other ports validate user name or character name here */
|
||||
return TRUE;
|
||||
#else
|
||||
wizard = FALSE;
|
||||
return 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 */
|
||||
}
|
||||
|
||||
/*macmain.c*/
|
||||
|
||||
Reference in New Issue
Block a user