Fix: shunt to explore mode after wizmode auth fail

If an unauthorized player requests the game launch in wizard mode, it
will try to put her in explore mode instead.  If this happened during
restoration of a previous (normal) saved game, the setting of discover
in wd_message() would bypass iflags.deferred_X, allowing the player to
select to keep the non-explore-mode save file.  [Actually, when I tested
it I always got an error when answering yes to the "keep the save file?"
prompt, but that's a problem too...]  Because deferred_X was still 1
after this, the pline "You are already in explore mode" would also be
printed following the prompt (when moveloop_preamble() attempted to set
explore mode).

Fix this so that loading a normal game with -D, then failing the
authorization, boots into explore mode via iflags.deferred_X and the
"really enter explore mode?" prompt, as it would have if -X were
specified on the command line to begin with.
This commit is contained in:
Michael Meyer
2023-10-20 14:37:58 -04:00
committed by PatR
parent 85b727c92c
commit 1e237e4b8f
3 changed files with 9 additions and 11 deletions

View File

@@ -10258,8 +10258,10 @@ set_playmode(void)
else
wizard = FALSE; /* not allowed or not available */
/* try explore mode if we didn't make it into wizard mode */
/* if requesting wizard mode when restoring a normal game, this will
set iflags.deferred_X and prompt to activate explore mode after the
save file has already been deleted */
discover = !wizard;
iflags.deferred_X = FALSE;
}
if (discover && !authorize_explore_mode()) {
discover = iflags.deferred_X = FALSE;

View File

@@ -633,14 +633,12 @@ wd_message(void)
} else {
You("cannot access debug (wizard) mode.");
}
wizard = 0; /* (paranoia) */
if (!explore_error_flag) {
wizard = FALSE; /* (paranoia) */
if (!explore_error_flag)
pline("Entering explore/discovery mode instead.");
discover = 1;
}
} else if (explore_error_flag) {
You("cannot access explore mode."); /* same as enter_explore_mode */
discover = 0; /* (more paranoia) */
discover = iflags.deferred_X = FALSE; /* (more paranoia) */
} else if (discover)
You("are in non-scoring explore/discovery mode.");
}

View File

@@ -992,14 +992,12 @@ wd_message(void)
} else {
You("cannot access debug (wizard) mode.");
}
wizard = 0; /* (paranoia) */
if (!explore_error_flag) {
wizard = FALSE; /* (paranoia) */
if (!explore_error_flag)
pline("Entering explore/discovery mode instead.");
discover = 1;
}
} else if (explore_error_flag) {
You("cannot access explore mode."); /* same as enter_explore_mode */
discover = 0; /* (more paranoia) */
discover = iflags.deferred_X = FALSE; /* (more paranoia) */
} else if (discover)
You("are in non-scoring explore/discovery mode.");
}