Apply sysconf EXPLORERS restriction on startup
The sysconf EXPLORERS list restricting access to explore mode was being evaluated and used when a player used the #exploremode command in-game, or when specifying -X or OPTIONS=playmode:explore on the command line when resuming a normal game, but not when starting an entirely new game. When SYSCF is avilable, check for authorization early, similar to debug mode authorization, to restrict access to explore mode to EXPLORERS under (hopefully) all circumstances.
This commit is contained in:
@@ -965,10 +965,7 @@ enter_explore_mode(void)
|
||||
} else {
|
||||
const char *oldmode = !wizard ? "normal game" : "debug mode";
|
||||
|
||||
#ifdef SYSCF
|
||||
#if defined(UNIX)
|
||||
if (!sysopt.explorers || !sysopt.explorers[0]
|
||||
|| !check_user_string(sysopt.explorers)) {
|
||||
if (!authorize_explore_mode()) {
|
||||
if (!wizard) {
|
||||
You("cannot access explore mode.");
|
||||
return ECMD_OK;
|
||||
@@ -978,8 +975,6 @@ enter_explore_mode(void)
|
||||
/* keep going */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
pline("Beware! From explore mode there will be no return to %s,",
|
||||
oldmode);
|
||||
if (paranoid_query(ParanoidQuit,
|
||||
|
||||
@@ -10257,11 +10257,14 @@ set_playmode(void)
|
||||
gp.plnamelen = (int) strlen(strcpy(gp.plname, "wizard"));
|
||||
else
|
||||
wizard = FALSE; /* not allowed or not available */
|
||||
/* force explore mode if we didn't make it into wizard mode */
|
||||
/* try explore mode if we didn't make it into wizard mode */
|
||||
discover = !wizard;
|
||||
iflags.deferred_X = FALSE;
|
||||
}
|
||||
/* don't need to do anything special for explore mode or normal play */
|
||||
if (discover && !authorize_explore_mode()) {
|
||||
discover = iflags.deferred_X = FALSE;
|
||||
}
|
||||
/* don't need to do anything special for normal play */
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -560,8 +560,8 @@ restgamestate(NHFILE *nhfp)
|
||||
if (newgameflags.debug) {
|
||||
/* authorized by startup code; wizard mode exists and is allowed */
|
||||
wizard = TRUE, discover = iflags.deferred_X = FALSE;
|
||||
} else if (wizard) {
|
||||
/* specified by save file; check authorization now */
|
||||
} else if (wizard || discover) {
|
||||
/* specified by save file; check authorization now. */
|
||||
set_playmode();
|
||||
}
|
||||
role_init(); /* Reset the initial role, race, gender, and alignment */
|
||||
|
||||
Reference in New Issue
Block a user