follow-up, program_state
This commit is contained in:
+4
-4
@@ -71,7 +71,7 @@ moveloop_preamble(boolean resuming)
|
||||
}
|
||||
|
||||
if (!resuming) { /* new game */
|
||||
svp.program_state.beyond_savefile_load = 1; /* for TTY_PERM_INVENT */
|
||||
program_state.beyond_savefile_load = 1; /* for TTY_PERM_INVENT */
|
||||
svc.context.rndencode = rnd(9000);
|
||||
set_wear((struct obj *) 0); /* for side-effects of starting gear */
|
||||
reset_justpicked(gi.invent);
|
||||
@@ -100,7 +100,7 @@ moveloop_preamble(boolean resuming)
|
||||
u.uz0.dlevel = u.uz.dlevel;
|
||||
svc.context.move = 0;
|
||||
|
||||
svp.program_state.in_moveloop = 1;
|
||||
program_state.in_moveloop = 1;
|
||||
/* for perm_invent preset at startup, display persistent inventory after
|
||||
invent is fully populated and the in_moveloop flag has been set */
|
||||
if (iflags.perm_invent)
|
||||
@@ -166,7 +166,7 @@ moveloop_core(void)
|
||||
boolean monscanmove = FALSE;
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
end_of_input();
|
||||
#endif
|
||||
get_nh_event();
|
||||
@@ -781,7 +781,7 @@ newgame(void)
|
||||
#ifdef INSURANCE
|
||||
save_currentstate();
|
||||
#endif
|
||||
svp.program_state.something_worth_saving++; /* useful data now exists */
|
||||
program_state.something_worth_saving++; /* useful data now exists */
|
||||
|
||||
/* Success! */
|
||||
welcome(TRUE);
|
||||
|
||||
+1
-1
@@ -705,7 +705,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
|
||||
* when restoring a game
|
||||
*/
|
||||
(void) make_hallucinated((long) !on,
|
||||
svp.program_state.restoring ? FALSE : TRUE,
|
||||
program_state.restoring ? FALSE : TRUE,
|
||||
wp_mask);
|
||||
}
|
||||
if (spfx & SPFX_ESP) {
|
||||
|
||||
+1
-1
@@ -191,7 +191,7 @@ adjattrib(
|
||||
disp.botl = TRUE;
|
||||
if (msgflg <= 0)
|
||||
You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr);
|
||||
if (svp.program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
|
||||
if (program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
|
||||
(void) encumber_msg();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3294,7 +3294,7 @@ rhack(int key)
|
||||
svc.context.nopick = 0;
|
||||
got_prefix_input:
|
||||
#ifdef SAFERHANGUP
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
end_of_input();
|
||||
#endif
|
||||
if ((cmdq = cmdq_pop()) != 0) {
|
||||
@@ -3634,7 +3634,7 @@ getdir(const char *s)
|
||||
}
|
||||
|
||||
retry:
|
||||
svp.program_state.input_state = getdirInp;
|
||||
program_state.input_state = getdirInp;
|
||||
if (gi.in_doagain || *readchar_queue)
|
||||
dirsym = readchar();
|
||||
else
|
||||
@@ -4648,7 +4648,7 @@ get_count(
|
||||
unsigned gc_flags) /* control flags: GC_SAVEHIST, GC_ECHOFIRST */
|
||||
{
|
||||
char qbuf[QBUFSZ];
|
||||
int key, save_input_state = svp.program_state.input_state;
|
||||
int key, save_input_state = program_state.input_state;
|
||||
long cnt = 0L, first = inkey ? (long) (inkey - '0') : 0L;
|
||||
boolean backspaced = FALSE, showzero = TRUE,
|
||||
/* should "Count: 123" go into message history? */
|
||||
@@ -4670,7 +4670,7 @@ get_count(
|
||||
} else {
|
||||
/* if readchar() has already been called in this loop, it will
|
||||
have reset input_state; put that back to its previous value */
|
||||
svp.program_state.input_state = save_input_state;
|
||||
program_state.input_state = save_input_state;
|
||||
key = readchar();
|
||||
}
|
||||
|
||||
@@ -4737,7 +4737,7 @@ parse(void)
|
||||
|
||||
/* affects readchar() behavior for ESC iff 'altmeta' option is On;
|
||||
is always reset to otherInp by readchar() */
|
||||
svp.program_state.input_state = commandInp;
|
||||
program_state.input_state = commandInp;
|
||||
|
||||
if (!gc.Cmd.num_pad || (foo = readchar()) == gc.Cmd.spkeys[NHKF_COUNT]) {
|
||||
/* if 'num_pad' is On then readchar() has just reset input_state;
|
||||
@@ -4745,7 +4745,7 @@ parse(void)
|
||||
otherwise "n<count>ESC<character>" becomes "n<count>ESC" (with
|
||||
<character> not read from keyboard yet) rather than intended count
|
||||
and meta keystroke "n<count>M-<character>" */
|
||||
svp.program_state.input_state = commandInp;
|
||||
program_state.input_state = commandInp;
|
||||
|
||||
foo = get_count((char *) 0, '\0', LARGEST_INT,
|
||||
&gc.command_count, GC_NOFLAGS);
|
||||
@@ -4791,8 +4791,8 @@ hangup(
|
||||
int sig_unused UNUSED) /* called as signal() handler, so sent
|
||||
* at least one arg */
|
||||
{
|
||||
if (svp.program_state.exiting)
|
||||
svp.program_state.in_moveloop = 0;
|
||||
if (program_state.exiting)
|
||||
program_state.in_moveloop = 0;
|
||||
nhwindows_hangup();
|
||||
#ifdef SAFERHANGUP
|
||||
/* When using SAFERHANGUP, the done_hup flag is tested in rhack
|
||||
@@ -4801,10 +4801,10 @@ hangup(
|
||||
protects against losing objects in the process of being thrown,
|
||||
but also potentially riskier because the disconnected program
|
||||
must continue running longer before attempting a hangup save. */
|
||||
svp.program_state.done_hup++;
|
||||
program_state.done_hup++;
|
||||
/* defer hangup iff game appears to be in progress */
|
||||
if (svp.program_state.in_moveloop
|
||||
&& svp.program_state.something_worth_saving)
|
||||
if (program_state.in_moveloop
|
||||
&& program_state.something_worth_saving)
|
||||
return;
|
||||
#endif /* SAFERHANGUP */
|
||||
end_of_input();
|
||||
@@ -4815,16 +4815,16 @@ end_of_input(void)
|
||||
{
|
||||
#ifdef NOSAVEONHANGUP
|
||||
#ifdef INSURANCE
|
||||
if (flags.ins_chkpt && svp.program_state.something_worth_saving)
|
||||
if (flags.ins_chkpt && program_state.something_worth_saving)
|
||||
program_state.preserve_locks = 1; /* keep files for recovery */
|
||||
#endif
|
||||
svp.program_state.something_worth_saving = 0; /* don't save */
|
||||
program_state.something_worth_saving = 0; /* don't save */
|
||||
#endif
|
||||
|
||||
#ifndef SAFERHANGUP
|
||||
if (!svp.program_state.done_hup++)
|
||||
if (!program_state.done_hup++)
|
||||
#endif
|
||||
if (svp.program_state.something_worth_saving)
|
||||
if (program_state.something_worth_saving)
|
||||
(void) dosave0();
|
||||
if (soundprocs.sound_exit_nhsound)
|
||||
(*soundprocs.sound_exit_nhsound)("end_of_input");
|
||||
@@ -4875,7 +4875,7 @@ readchar_core(coordxy *x, coordxy *y, int *mod)
|
||||
sym = '\033';
|
||||
#ifdef ALTMETA
|
||||
} else if (sym == '\033' && iflags.altmeta
|
||||
&& svp.program_state.input_state != otherInp) {
|
||||
&& program_state.input_state != otherInp) {
|
||||
/* iflags.altmeta: treat two character ``ESC c'' as single `M-c' but
|
||||
only when we're called by parse() [possibly via get_count()]
|
||||
or getpos() [to support Alt+digit] or getdir() [for arrow keys
|
||||
@@ -4895,7 +4895,7 @@ readchar_core(coordxy *x, coordxy *y, int *mod)
|
||||
readchar_done:
|
||||
/* next readchar() will be for an ordinary char unless parse()
|
||||
sets this back to non-zero */
|
||||
svp.program_state.input_state = otherInp;
|
||||
program_state.input_state = otherInp;
|
||||
return (char) sym;
|
||||
}
|
||||
|
||||
@@ -4917,7 +4917,7 @@ readchar_poskey(coordxy *x, coordxy *y, int *mod)
|
||||
{
|
||||
char ch;
|
||||
|
||||
svp.program_state.input_state = getposInp;
|
||||
program_state.input_state = getposInp;
|
||||
ch = readchar_core(x, y, mod);
|
||||
return ch;
|
||||
}
|
||||
@@ -5171,7 +5171,7 @@ yn_function(
|
||||
res = altres;
|
||||
}
|
||||
/* in case we're called via getdir() which sets input_state */
|
||||
svp.program_state.input_state = otherInp;
|
||||
program_state.input_state = otherInp;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -986,7 +986,6 @@ static const struct instance_globals_saved_p init_svp = {
|
||||
DUMMY, /* plname */
|
||||
DUMMY, /* pl_character */
|
||||
DUMMY, /* pl_fruit */
|
||||
UNDEFINED_VALUES, /* program_state */
|
||||
};
|
||||
|
||||
static const struct instance_globals_saved_q init_svq = {
|
||||
@@ -1029,6 +1028,8 @@ static const struct instance_globals_saved_y init_svy = {
|
||||
UNDEFINED_VALUE /* ymax */
|
||||
};
|
||||
|
||||
static const struct sinfo init_program_state = { 0 };
|
||||
|
||||
#if 0
|
||||
struct instance_globals g;
|
||||
#endif /* 0 */
|
||||
@@ -1078,6 +1079,7 @@ struct instance_globals_saved_t svt;
|
||||
struct instance_globals_saved_u svu;
|
||||
struct instance_globals_saved_x svx;
|
||||
struct instance_globals_saved_y svy;
|
||||
struct sinfo program_state;
|
||||
|
||||
const struct const_globals cg = {
|
||||
DUMMY, /* zeroobj */
|
||||
@@ -1154,6 +1156,7 @@ decl_globals_init(void)
|
||||
svu = init_svu;
|
||||
svx = init_svx;
|
||||
svy = init_svy;
|
||||
program_state = init_program_state;
|
||||
|
||||
gv.valuables[0].list = gg.gems;
|
||||
gv.valuables[0].size = SIZE(gg.gems);
|
||||
|
||||
+8
-8
@@ -676,10 +676,10 @@ next_to_gas(
|
||||
boolean
|
||||
suppress_map_output(void)
|
||||
{
|
||||
if (gi.in_mklev || svp.program_state.saving || svp.program_state.restoring)
|
||||
if (gi.in_mklev || program_state.saving || program_state.restoring)
|
||||
return TRUE;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
return TRUE;
|
||||
#endif
|
||||
return FALSE;
|
||||
@@ -1658,10 +1658,10 @@ docrt_flags(int refresh_flags)
|
||||
redrawonly = (refresh_flags & docrtRefresh) != 0,
|
||||
nocls = (refresh_flags & docrtNocls) != 0;
|
||||
|
||||
if (!u.ux || svp.program_state.in_docrt)
|
||||
if (!u.ux || program_state.in_docrt)
|
||||
return; /* display isn't ready yet */
|
||||
|
||||
svp.program_state.in_docrt = TRUE;
|
||||
program_state.in_docrt = TRUE;
|
||||
|
||||
if (redrawonly) {
|
||||
redraw_map(FALSE);
|
||||
@@ -1713,7 +1713,7 @@ docrt_flags(int refresh_flags)
|
||||
disp.botlx = TRUE; /* force a redraw of the bottom lines */
|
||||
/* note: caller needs to call bot() to actually redraw status */
|
||||
}
|
||||
svp.program_state.in_docrt = FALSE;
|
||||
program_state.in_docrt = FALSE;
|
||||
}
|
||||
|
||||
/* for panning beyond a clipped region; resend the current map data to
|
||||
@@ -1949,8 +1949,8 @@ show_glyph(coordxy x, coordxy y, int glyph)
|
||||
oldglyph = gg.gbuf[y][x].glyphinfo.glyph;
|
||||
|
||||
if (a11y.glyph_updates && !a11y.mon_notices_blocked
|
||||
&& !svp.program_state.in_docrt
|
||||
&& !svp.program_state.in_getlev
|
||||
&& !program_state.in_docrt
|
||||
&& !program_state.in_getlev
|
||||
&& (oldglyph != glyph || gg.gbuf[y][x].gnew)) {
|
||||
int c = glyph_to_cmap(glyph);
|
||||
if ((glyph_is_nothing(oldglyph) || glyph_is_unexplored(oldglyph)
|
||||
@@ -2165,7 +2165,7 @@ flush_screen(int cursor_on_u)
|
||||
return; /* if already flushing then return */
|
||||
flushing = 1;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -900,7 +900,7 @@ obj_no_longer_held(struct obj *obj)
|
||||
*/
|
||||
if (!obj->oerodeproof || !rn2(10)) {
|
||||
/* if monsters aren't moving, assume player is responsible */
|
||||
if (!svc.context.mon_moving && !svp.program_state.gameover)
|
||||
if (!svc.context.mon_moving && !program_state.gameover)
|
||||
costly_alteration(obj, COST_DEGRD);
|
||||
obj->otyp = WORM_TOOTH;
|
||||
obj->oerodeproof = 0;
|
||||
@@ -1348,7 +1348,7 @@ save_currentstate(void)
|
||||
{
|
||||
NHFILE *nhfp;
|
||||
|
||||
svp.program_state.in_checkpoint++;
|
||||
program_state.in_checkpoint++;
|
||||
if (flags.ins_chkpt) {
|
||||
/* write out just-attained level, with pets and everything */
|
||||
nhfp = currentlevel_rewrite();
|
||||
@@ -1363,7 +1363,7 @@ save_currentstate(void)
|
||||
|
||||
/* write out non-level state */
|
||||
savestateinlock();
|
||||
svp.program_state.in_checkpoint--;
|
||||
program_state.in_checkpoint--;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+3
-3
@@ -839,7 +839,7 @@ x_monnam(
|
||||
if (mtmp == &gy.youmonst)
|
||||
return strcpy(buf, "you"); /* ignore article, "invisible", &c */
|
||||
|
||||
if (svp.program_state.gameover)
|
||||
if (program_state.gameover)
|
||||
suppress |= SUPPRESS_HALLUCINATION;
|
||||
if (article == ARTICLE_YOUR && !mtmp->mtame)
|
||||
article = ARTICLE_THE;
|
||||
@@ -857,7 +857,7 @@ x_monnam(
|
||||
do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION);
|
||||
do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE);
|
||||
do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR
|
||||
&& !svp.program_state.gameover && mtmp != u.usteed
|
||||
&& !program_state.gameover && mtmp != u.usteed
|
||||
&& !engulfing_u(mtmp) && !(suppress & SUPPRESS_IT);
|
||||
do_saddle = !(suppress & SUPPRESS_SADDLE);
|
||||
do_mappear = mappear_as_mon && !(suppress & SUPPRESS_MAPPEARANCE);
|
||||
@@ -1481,7 +1481,7 @@ const char *
|
||||
hliquid(
|
||||
const char *liquidpref) /* use as-is when not hallucintg (unless empty) */
|
||||
{
|
||||
boolean hallucinate = Hallucination && !svp.program_state.gameover;
|
||||
boolean hallucinate = Hallucination && !program_state.gameover;
|
||||
|
||||
if (hallucinate || !liquidpref || !*liquidpref) {
|
||||
int indx, count = SIZE(hliquids);
|
||||
|
||||
+1
-1
@@ -810,7 +810,7 @@ dragon_armor_handling(
|
||||
case GOLD_DRAGON_SCALES:
|
||||
case GOLD_DRAGON_SCALE_MAIL:
|
||||
(void) make_hallucinated((long) !puton,
|
||||
svp.program_state.restoring ? FALSE : TRUE,
|
||||
program_state.restoring ? FALSE : TRUE,
|
||||
W_ARM);
|
||||
break;
|
||||
case ORANGE_DRAGON_SCALES:
|
||||
|
||||
@@ -43,7 +43,7 @@ ATTRNORETURN extern void nethack_exit(int) NORETURN;
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
|
||||
#define done_stopprint svp.program_state.stopprint
|
||||
#define done_stopprint program_state.stopprint
|
||||
|
||||
/*
|
||||
* The order of these needs to match the macros in hack.h.
|
||||
@@ -175,7 +175,7 @@ staticfn void
|
||||
done_hangup(int sig)
|
||||
{
|
||||
#ifdef HANGUPHANDLING
|
||||
svp.program_state.done_hup++;
|
||||
program_state.done_hup++;
|
||||
#endif
|
||||
sethanguphandler((void (*)(int)) SIG_IGN);
|
||||
done_intr(sig);
|
||||
@@ -391,7 +391,7 @@ panic VA_DECL(const char *, str)
|
||||
VA_START(str);
|
||||
VA_INIT(str, char *);
|
||||
|
||||
if (svp.program_state.panicking++)
|
||||
if (program_state.panicking++)
|
||||
NH_abort(NULL); /* avoid loops - this should never happen*/
|
||||
|
||||
gb.bot_disabled = TRUE;
|
||||
@@ -404,9 +404,9 @@ panic VA_DECL(const char *, str)
|
||||
iflags.window_inited = FALSE; /* they're gone; force raw_print()ing */
|
||||
}
|
||||
|
||||
raw_print(svp.program_state.gameover
|
||||
raw_print(program_state.gameover
|
||||
? "Postgame wrapup disrupted."
|
||||
: !svp.program_state.something_worth_saving
|
||||
: !program_state.something_worth_saving
|
||||
? "Program initialization has failed."
|
||||
: "Suddenly, the dungeon collapses.");
|
||||
#ifndef MICRO
|
||||
@@ -414,11 +414,11 @@ panic VA_DECL(const char *, str)
|
||||
if (!wizard)
|
||||
raw_printf("Report the following error to \"%s\" or at \"%s\".",
|
||||
DEVTEAM_EMAIL, DEVTEAM_URL);
|
||||
else if (svp.program_state.something_worth_saving)
|
||||
else if (program_state.something_worth_saving)
|
||||
raw_print("\nError save file being written.\n");
|
||||
#else /* !NOTIFY_NETHACK_BUGS */
|
||||
if (!wizard) {
|
||||
const char *maybe_rebuild = !svp.program_state.something_worth_saving
|
||||
const char *maybe_rebuild = !program_state.something_worth_saving
|
||||
? "."
|
||||
: "\nand it may be possible to rebuild.";
|
||||
|
||||
@@ -437,7 +437,7 @@ panic VA_DECL(const char *, str)
|
||||
/* XXX can we move this above the prints? Then we'd be able to
|
||||
* suppress "it may be possible to rebuild" based on dosave0()
|
||||
* or say it's NOT possible to rebuild. */
|
||||
if (svp.program_state.something_worth_saving && !iflags.debug_fuzzer) {
|
||||
if (program_state.something_worth_saving && !iflags.debug_fuzzer) {
|
||||
set_error_savefile();
|
||||
if (dosave0()) {
|
||||
/* os/win port specific recover instructions */
|
||||
@@ -937,7 +937,7 @@ fuzzer_savelife(int how)
|
||||
* Some debugging code pulled out of done() to unclutter it.
|
||||
* 'done_seq' is maintained in done().
|
||||
*/
|
||||
if (!svp.program_state.panicking
|
||||
if (!program_state.panicking
|
||||
&& how != PANICKED && how != TRICKED) {
|
||||
savelife(how);
|
||||
|
||||
@@ -1019,9 +1019,9 @@ done(int how)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (svp.program_state.panicking
|
||||
if (program_state.panicking
|
||||
#ifdef HANGUPHANDLING
|
||||
|| svp.program_state.done_hup
|
||||
|| program_state.done_hup
|
||||
#endif
|
||||
|| (how == QUIT && done_stopprint)) {
|
||||
/* skip status update if panicking or disconnected
|
||||
@@ -1094,7 +1094,7 @@ done(int how)
|
||||
/* if hangup has occurred, the only possible answer to a paranoid
|
||||
query is 'no'; we want 'no' as the default for "Die?" but can't
|
||||
accept it more than once if there's no user supplying it */
|
||||
&& !(svp.program_state.done_hup && gd.done_seq++ == gh.hero_seq)
|
||||
&& !(program_state.done_hup && gd.done_seq++ == gh.hero_seq)
|
||||
#endif
|
||||
&& !paranoid_query(ParanoidDie, "Die?")) {
|
||||
pline("OK, so you don't %s.", (how == CHOKING) ? "choke" : "die");
|
||||
@@ -1128,11 +1128,11 @@ really_done(int how)
|
||||
/*
|
||||
* The game is now over...
|
||||
*/
|
||||
svp.program_state.gameover = 1;
|
||||
program_state.gameover = 1;
|
||||
/* in case of a subsequent panic(), there's no point trying to save */
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
done_stopprint++;
|
||||
#endif
|
||||
/* render vision subsystem inoperative */
|
||||
@@ -1140,7 +1140,7 @@ really_done(int how)
|
||||
|
||||
/* maybe use up active invent item(s), place thrown/kicked missile,
|
||||
deal with ball and chain possibly being temporarily off the map */
|
||||
if (!svp.program_state.panicking)
|
||||
if (!program_state.panicking)
|
||||
done_object_cleanup();
|
||||
/* in case we're panicking; normally cleared by done_object_cleanup() */
|
||||
iflags.perm_invent = FALSE;
|
||||
@@ -1657,7 +1657,7 @@ container_contents(
|
||||
ATTRNORETURN void
|
||||
nh_terminate(int status)
|
||||
{
|
||||
svp.program_state.in_moveloop = 0; /* won't be returning to normal play */
|
||||
program_state.in_moveloop = 0; /* won't be returning to normal play */
|
||||
|
||||
l_nhcore_call(NHCORE_GAME_EXIT);
|
||||
#ifdef MAC
|
||||
@@ -1665,7 +1665,7 @@ nh_terminate(int status)
|
||||
#endif
|
||||
/* don't bother to try to release memory if we're in panic mode, to
|
||||
avoid trouble in case that happens to be due to memory problems */
|
||||
if (!svp.program_state.panicking) {
|
||||
if (!program_state.panicking) {
|
||||
freedynamicdata();
|
||||
dlb_cleanup();
|
||||
l_nhcore_done();
|
||||
@@ -1679,10 +1679,10 @@ nh_terminate(int status)
|
||||
*/
|
||||
/* don't call exit() if already executing within an exit handler;
|
||||
that would cancel any other pending user-mode handlers */
|
||||
if (svp.program_state.exiting)
|
||||
if (program_state.exiting)
|
||||
return;
|
||||
#endif
|
||||
svp.program_state.exiting = 1;
|
||||
program_state.exiting = 1;
|
||||
nethack_exit(status);
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -703,7 +703,7 @@ clearlocks(void)
|
||||
int x;
|
||||
|
||||
#ifdef HANGUPHANDLING
|
||||
if (svp.program_state.preserve_locks)
|
||||
if (program_state.preserve_locks)
|
||||
return;
|
||||
#endif
|
||||
#ifndef NO_SIGNAL
|
||||
@@ -1101,7 +1101,7 @@ create_savefile(void)
|
||||
nhfp->fieldlevel = FALSE;
|
||||
nhfp->ftype = NHF_SAVEFILE;
|
||||
nhfp->mode = WRITING;
|
||||
if (svp.program_state.in_self_recover || do_historical) {
|
||||
if (program_state.in_self_recover || do_historical) {
|
||||
do_historical = TRUE; /* force it */
|
||||
nhfp->structlevel = TRUE;
|
||||
nhfp->fieldlevel = FALSE;
|
||||
@@ -1155,7 +1155,7 @@ open_savefile(void)
|
||||
nhfp->fieldlevel = FALSE;
|
||||
nhfp->ftype = NHF_SAVEFILE;
|
||||
nhfp->mode = READING;
|
||||
if (svp.program_state.in_self_recover || do_historical) {
|
||||
if (program_state.in_self_recover || do_historical) {
|
||||
do_historical = TRUE; /* force it */
|
||||
nhfp->structlevel = TRUE;
|
||||
nhfp->fieldlevel = FALSE;
|
||||
@@ -1875,7 +1875,7 @@ static struct flock sflock; /* for unlocking, same as above */
|
||||
#endif
|
||||
|
||||
#if defined(HANGUPHANDLING)
|
||||
#define HUP if (!svp.program_state.done_hup)
|
||||
#define HUP if (!program_state.done_hup)
|
||||
#else
|
||||
#define HUP
|
||||
#endif
|
||||
@@ -3447,7 +3447,7 @@ config_error_init(boolean from_file, const char *sourcename, boolean secure)
|
||||
|
||||
tmp->next = config_error_data;
|
||||
config_error_data = tmp;
|
||||
svp.program_state.config_error_ready = TRUE;
|
||||
program_state.config_error_ready = TRUE;
|
||||
}
|
||||
|
||||
staticfn boolean
|
||||
@@ -3513,7 +3513,7 @@ config_erradd(const char *buf)
|
||||
punct = c_eos((char *) buf) - 1; /* eos(buf)-1 is valid */
|
||||
punct = strchr(".!?", *punct) ? "" : ".";
|
||||
|
||||
if (!svp.program_state.config_error_ready) {
|
||||
if (!program_state.config_error_ready) {
|
||||
/* either very early, where pline() will use raw_print(), or
|
||||
player gave bad value when prompted by interactive 'O' command */
|
||||
pline("%s%s%s", !iflags.window_inited ? "config_error_add: " : "",
|
||||
@@ -3575,7 +3575,7 @@ config_error_done(void)
|
||||
}
|
||||
config_error_data = tmp->next;
|
||||
free(tmp);
|
||||
svp.program_state.config_error_ready = (config_error_data != 0);
|
||||
program_state.config_error_ready = (config_error_data != 0);
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -3978,14 +3978,14 @@ read_wizkit(void)
|
||||
if (!wizard || !(fp = fopen_wizkit_file()))
|
||||
return;
|
||||
|
||||
svp.program_state.wizkit_wishing = 1;
|
||||
program_state.wizkit_wishing = 1;
|
||||
config_error_init(TRUE, "WIZKIT", FALSE);
|
||||
|
||||
parse_conf_file(fp, proc_wizkit_line);
|
||||
(void) fclose(fp);
|
||||
|
||||
config_error_done();
|
||||
svp.program_state.wizkit_wishing = 0;
|
||||
program_state.wizkit_wishing = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -4195,8 +4195,8 @@ paniclog(
|
||||
#ifdef PANICLOG
|
||||
FILE *lfile;
|
||||
|
||||
if (!svp.program_state.in_paniclog) {
|
||||
svp.program_state.in_paniclog = 1;
|
||||
if (!program_state.in_paniclog) {
|
||||
program_state.in_paniclog = 1;
|
||||
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
|
||||
if (lfile) {
|
||||
#ifdef PANICLOG_FMT2
|
||||
@@ -4216,7 +4216,7 @@ paniclog(
|
||||
#endif /* !PANICLOG_FMT2 */
|
||||
(void) fclose(lfile);
|
||||
}
|
||||
svp.program_state.in_paniclog = 0;
|
||||
program_state.in_paniclog = 0;
|
||||
}
|
||||
#endif /* PANICLOG */
|
||||
return;
|
||||
@@ -4323,9 +4323,9 @@ recover_savefile(void)
|
||||
/*
|
||||
* Set a flag for the savefile routines to know the
|
||||
* circumstances and act accordingly:
|
||||
* svp.program_state.in_self_recover
|
||||
* program_state.in_self_recover
|
||||
*/
|
||||
svp.program_state.in_self_recover = TRUE;
|
||||
program_state.in_self_recover = TRUE;
|
||||
set_savefile_name(TRUE);
|
||||
snhfp = create_savefile();
|
||||
if (!snhfp) {
|
||||
@@ -4433,11 +4433,11 @@ recover_savefile(void)
|
||||
close_nhfile(gnhfp);
|
||||
close_nhfile(snhfp);
|
||||
close_nhfile(lnhfp);
|
||||
svp.program_state.in_self_recover = FALSE;
|
||||
program_state.in_self_recover = FALSE;
|
||||
delete_savefile();
|
||||
return FALSE;
|
||||
}
|
||||
/* we don't clear svp.program_state.in_self_recover here, we
|
||||
/* we don't clear program_state.in_self_recover here, we
|
||||
leave it as a flag to reload the structlevel savefile
|
||||
in the caller. The caller should then clear it. */
|
||||
return TRUE;
|
||||
|
||||
+5
-5
@@ -2395,7 +2395,7 @@ record_achievement(schar achidx)
|
||||
/* avoid livelog for achievements recorded during final disclosure:
|
||||
nudist and blind-from-birth; also ascension which is suppressed
|
||||
by this gets logged separately in really_done() */
|
||||
if (svp.program_state.gameover)
|
||||
if (program_state.gameover)
|
||||
return;
|
||||
|
||||
if (absidx >= ACH_RNK1 && absidx <= ACH_RNK8) {
|
||||
@@ -2717,7 +2717,7 @@ dovanquished(void)
|
||||
#define UniqCritterIndx(mndx) \
|
||||
((mons[mndx].geno & G_UNIQ) != 0 && mndx != PM_HIGH_CLERIC)
|
||||
|
||||
#define done_stopprint svp.program_state.stopprint
|
||||
#define done_stopprint program_state.stopprint
|
||||
|
||||
void
|
||||
list_vanquished(char defquery, boolean ask)
|
||||
@@ -2852,7 +2852,7 @@ list_vanquished(char defquery, boolean ask)
|
||||
* still in progress, so use present tense via pline(), or for dumplog
|
||||
* which needs putstr() and past tense.
|
||||
*/
|
||||
} else if (!svp.program_state.gameover) {
|
||||
} else if (!program_state.gameover) {
|
||||
/* #vanquished rather than final disclosure, so pline() is ok */
|
||||
pline("No creatures have been vanquished.");
|
||||
#ifdef DUMPLOG
|
||||
@@ -2927,7 +2927,7 @@ list_genocided(char defquery, boolean ask)
|
||||
char buf[BUFSZ];
|
||||
boolean genoing, /* prompting for genocide or class genocide */
|
||||
dumping; /* for DUMPLOG; doesn't need to be conditional */
|
||||
boolean both = (svp.program_state.gameover || wizard || discover);
|
||||
boolean both = (program_state.gameover || wizard || discover);
|
||||
|
||||
dumping = (defquery == 'd');
|
||||
genoing = (defquery == 'g');
|
||||
@@ -3031,7 +3031,7 @@ list_genocided(char defquery, boolean ask)
|
||||
}
|
||||
|
||||
/* See the comment for similar code near the end of list_vanquished(). */
|
||||
} else if (!svp.program_state.gameover) {
|
||||
} else if (!program_state.gameover) {
|
||||
/* #genocided rather than final disclosure, so pline() is ok and
|
||||
extinction has been ignored */
|
||||
pline("No creatures have been genocided%s.", genoing ? " yet" : "");
|
||||
|
||||
+4
-4
@@ -355,7 +355,7 @@ loot_xname(struct obj *obj)
|
||||
if (wizard) { /* flags.debug */
|
||||
/* paranoia: before toggling off wizard mode, guard against a
|
||||
panic in xname() producing a normal mode panic save file */
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
flags.debug = FALSE;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ loot_xname(struct obj *obj)
|
||||
|
||||
if (save_debug) {
|
||||
flags.debug = TRUE;
|
||||
svp.program_state.something_worth_saving = 1;
|
||||
program_state.something_worth_saving = 1;
|
||||
}
|
||||
/* restore the object */
|
||||
if (obj->oclass == POTION_CLASS) {
|
||||
@@ -2650,7 +2650,7 @@ update_inventory(void)
|
||||
{
|
||||
int save_suppress_price;
|
||||
|
||||
if (!svp.program_state.in_moveloop) /* not covered by suppress_map_output */
|
||||
if (!program_state.in_moveloop) /* not covered by suppress_map_output */
|
||||
return;
|
||||
if (suppress_map_output()) /* despite name, used for perm_invent too */
|
||||
return;
|
||||
@@ -6120,7 +6120,7 @@ sync_perminvent(void)
|
||||
WIN_INVEN = create_nhwindow(NHW_MENU);
|
||||
}
|
||||
|
||||
if (WIN_INVEN != WIN_ERR && svp.program_state.beyond_savefile_load) {
|
||||
if (WIN_INVEN != WIN_ERR && program_state.beyond_savefile_load) {
|
||||
gi.in_sync_perminvent = 1;
|
||||
(void) display_inventory((char *) 0, FALSE);
|
||||
gi.in_sync_perminvent = 0;
|
||||
|
||||
+2
-2
@@ -1755,7 +1755,7 @@ restore_waterlevel(NHFILE *nhfp)
|
||||
b->next = (struct bubble *) 0;
|
||||
} else {
|
||||
/* avoid "saving and reloading may fix this" */
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
/* during restore, information about what level this is might not
|
||||
be available so we're wishy-washy about what we describe */
|
||||
impossible("No %s to restore?",
|
||||
@@ -1764,7 +1764,7 @@ restore_waterlevel(NHFILE *nhfp)
|
||||
: (Is_airlevel(&u.uz) || Is_airlevel(&gu.uz_save))
|
||||
? "clouds"
|
||||
: "air bubbles or clouds");
|
||||
svp.program_state.something_worth_saving = 1;
|
||||
program_state.something_worth_saving = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1176,7 +1176,7 @@ movemon_singlemon(struct monst *mtmp)
|
||||
if (u.utotype
|
||||
#ifdef SAFERHANGUP
|
||||
/* or if the program has lost contact with the user */
|
||||
|| svp.program_state.done_hup
|
||||
|| program_state.done_hup
|
||||
#endif
|
||||
) {
|
||||
gs.somebody_can_move = FALSE;
|
||||
|
||||
+1
-1
@@ -460,7 +460,7 @@ discover_object(
|
||||
exercise(A_WIS, TRUE);
|
||||
}
|
||||
/* !in_moveloop => initial inventory, gameover => final disclosure */
|
||||
if (svp.program_state.in_moveloop && !svp.program_state.gameover) {
|
||||
if (program_state.in_moveloop && !program_state.gameover) {
|
||||
if (objects[oindx].oc_class == GEM_CLASS)
|
||||
gem_learned(oindx); /* could affect price of unpaid gems */
|
||||
update_inventory();
|
||||
|
||||
+6
-6
@@ -325,7 +325,7 @@ obj_is_pname(struct obj *obj)
|
||||
{
|
||||
if (!obj->oartifact || !has_oname(obj))
|
||||
return FALSE;
|
||||
if (!svp.program_state.gameover && !iflags.override_ID) {
|
||||
if (!program_state.gameover && !iflags.override_ID) {
|
||||
if (not_fully_identified(obj))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ distant_name(
|
||||
against a potential extra chance to browse the map with getpos()
|
||||
during final disclosure (not currently implemented, nor planned) */
|
||||
save_oid = obj->o_id;
|
||||
if (svp.program_state.gameover)
|
||||
if (program_state.gameover)
|
||||
obj->o_id = 0;
|
||||
|
||||
/* this maybe-nearby part used to be replicated in multiple callers */
|
||||
@@ -955,7 +955,7 @@ xname_flags(
|
||||
"You were acid resistant because of your alchemy smock \
|
||||
with text \"Kiss the cook\"."
|
||||
when disclosing attributes anyway */
|
||||
if (svp.program_state.gameover && obj->o_id && bufspaceleft > 0) {
|
||||
if (program_state.gameover && obj->o_id && bufspaceleft > 0) {
|
||||
const char *lbl;
|
||||
char tmpbuf[BUFSZ];
|
||||
|
||||
@@ -1625,7 +1625,7 @@ doname_base(
|
||||
bill might not be available yet while restore is in progress
|
||||
(objects won't normally be formatted during that time, but if
|
||||
'perm_invent' is enabled then they might be [not any more...]) */
|
||||
if (iflags.suppress_price || svp.program_state.restoring) {
|
||||
if (iflags.suppress_price || program_state.restoring) {
|
||||
; /* don't attempt to obtain any shop pricing, even if 'with_price' */
|
||||
} else if (is_unpaid(obj)) { /* in inventory or in container in invent */
|
||||
char pricebuf[40];
|
||||
@@ -4894,7 +4894,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
||||
* Disallow such topology tweaks for WIZKIT startup wishes.
|
||||
*/
|
||||
wiztrap:
|
||||
if (wizard && !svp.program_state.wizkit_wishing && !d.oclass) {
|
||||
if (wizard && !program_state.wizkit_wishing && !d.oclass) {
|
||||
/* [inline code moved to separate routine to unclutter readobjnam] */
|
||||
if ((d.otmp = wizterrainwish(&d)) != 0)
|
||||
return d.otmp;
|
||||
@@ -4982,7 +4982,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
||||
if (rn1cnt > 6 - d.gsize)
|
||||
rn1cnt = 6 - d.gsize;
|
||||
if (d.cnt > rn1cnt
|
||||
&& (!wizard || svp.program_state.wizkit_wishing
|
||||
&& (!wizard || program_state.wizkit_wishing
|
||||
|| y_n("Override glob weight limit?") != 'y'))
|
||||
d.cnt = rn1cnt;
|
||||
d.otmp->owt *= (unsigned) d.cnt;
|
||||
|
||||
+3
-3
@@ -578,7 +578,7 @@ parseoptions(
|
||||
}
|
||||
|
||||
/* allow optfn's to test whether they were called from parseoptions() */
|
||||
svp.program_state.in_parseoptions++;
|
||||
program_state.in_parseoptions++;
|
||||
|
||||
if (got_match && matchidx >= 0) {
|
||||
duplicate = duplicate_opt_detection(matchidx);
|
||||
@@ -604,8 +604,8 @@ parseoptions(
|
||||
}
|
||||
}
|
||||
|
||||
if (svp.program_state.in_parseoptions > 0)
|
||||
svp.program_state.in_parseoptions--;
|
||||
if (program_state.in_parseoptions > 0)
|
||||
program_state.in_parseoptions--;
|
||||
|
||||
#if 0
|
||||
/* This specialization shouldn't be needed any longer because each of
|
||||
|
||||
+2
-2
@@ -507,7 +507,7 @@ waterbody_name(coordxy x, coordxy y)
|
||||
{
|
||||
static char pooltype[40];
|
||||
schar ltyp;
|
||||
boolean hallucinate = Hallucination && !svp.program_state.gameover;
|
||||
boolean hallucinate = Hallucination && !program_state.gameover;
|
||||
|
||||
if (!isok(x, y))
|
||||
return "drink"; /* should never happen */
|
||||
@@ -1203,7 +1203,7 @@ do_screen_description(
|
||||
skipped_venom = 0, found = 0; /* count of matching syms found */
|
||||
boolean hit_trap, need_to_look = FALSE,
|
||||
submerged = (Underwater && !Is_waterlevel(&u.uz)),
|
||||
hallucinate = (Hallucination && !svp.program_state.gameover);
|
||||
hallucinate = (Hallucination && !program_state.gameover);
|
||||
const char *x_str;
|
||||
nhsym tmpsym;
|
||||
glyph_info glyphinfo = nul_glyphinfo;
|
||||
|
||||
+10
-10
@@ -157,10 +157,10 @@ vpline(const char *line, va_list the_args)
|
||||
if (!line || !*line)
|
||||
return;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
return;
|
||||
#endif
|
||||
if (svp.program_state.wizkit_wishing)
|
||||
if (program_state.wizkit_wishing)
|
||||
return;
|
||||
|
||||
if (a11y.accessiblemsg && isok(a11y.msg_loc.x,a11y.msg_loc.y)) {
|
||||
@@ -542,7 +542,7 @@ raw_printf(const char *line, ...)
|
||||
va_start(the_args, line);
|
||||
vraw_printf(line, the_args);
|
||||
va_end(the_args);
|
||||
if (!svp.program_state.beyond_savefile_load)
|
||||
if (!program_state.beyond_savefile_load)
|
||||
ge.early_raw_messages++;
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ vraw_printf(const char *line, va_list the_args)
|
||||
#if defined(MSGHANDLER)
|
||||
execplinehandler(line);
|
||||
#endif
|
||||
if (!svp.program_state.beyond_savefile_load)
|
||||
if (!program_state.beyond_savefile_load)
|
||||
ge.early_raw_messages++;
|
||||
}
|
||||
|
||||
@@ -579,10 +579,10 @@ impossible(const char *s, ...)
|
||||
char pbuf2[BUFSZ];
|
||||
|
||||
va_start(the_args, s);
|
||||
if (svp.program_state.in_impossible)
|
||||
if (program_state.in_impossible)
|
||||
panic("impossible called impossible");
|
||||
|
||||
svp.program_state.in_impossible = 1;
|
||||
program_state.in_impossible = 1;
|
||||
(void) vsnprintf(pbuf, sizeof pbuf, s, the_args);
|
||||
va_end(the_args);
|
||||
pbuf[BUFSZ - 1] = '\0'; /* sanity */
|
||||
@@ -594,14 +594,14 @@ impossible(const char *s, ...)
|
||||
pline("%s", pbuf);
|
||||
gp.pline_flags = 0;
|
||||
|
||||
if (svp.program_state.in_sanity_check) {
|
||||
if (program_state.in_sanity_check) {
|
||||
/* skip rest of multi-line feedback */
|
||||
svp.program_state.in_impossible = 0;
|
||||
program_state.in_impossible = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Strcpy(pbuf2, "Program in disorder!");
|
||||
if (svp.program_state.something_worth_saving)
|
||||
if (program_state.something_worth_saving)
|
||||
Strcat(pbuf2, " (Saving and reloading may fix this problem.)");
|
||||
pline("%s", pbuf2);
|
||||
pline("Please report these messages to %s.", DEVTEAM_EMAIL);
|
||||
@@ -621,7 +621,7 @@ impossible(const char *s, ...)
|
||||
}
|
||||
#endif
|
||||
|
||||
svp.program_state.in_impossible = 0;
|
||||
program_state.in_impossible = 0;
|
||||
}
|
||||
|
||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ set_uasmon(void)
|
||||
which won't be known during the restore process: but BFlying
|
||||
and BStealth should be set correctly already in that case, so
|
||||
there's nothing to do */
|
||||
if (!svp.program_state.restoring)
|
||||
if (!program_state.restoring)
|
||||
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||
polysense();
|
||||
|
||||
|
||||
+1
-1
@@ -365,7 +365,7 @@ priestname(
|
||||
/* same as distant_monnam(), more or less... */
|
||||
if (do_hallu || !high_priest || reveal_high_priest
|
||||
|| !Is_astralevel(&u.uz)
|
||||
|| m_next2u(mon) || svp.program_state.gameover) {
|
||||
|| m_next2u(mon) || program_state.gameover) {
|
||||
Strcat(pname, " of ");
|
||||
Strcat(pname, halu_gname(mon_aligntyp(mon)));
|
||||
}
|
||||
|
||||
+1
-1
@@ -456,7 +456,7 @@ staticfn boolean
|
||||
skip_pager(boolean common UNUSED)
|
||||
{
|
||||
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
||||
if (svp.program_state.wizkit_wishing)
|
||||
if (program_state.wizkit_wishing)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+14
-14
@@ -721,7 +721,7 @@ restlevelfile(xint8 ltmp)
|
||||
nhfp = create_levelfile(ltmp, whynot);
|
||||
if (!nhfp) {
|
||||
/* failed to create a new file; don't attempt to make a panic save */
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
panic("restlevelfile: %s", whynot);
|
||||
}
|
||||
bufon(nhfp->fd);
|
||||
@@ -738,7 +738,7 @@ dorecover(NHFILE *nhfp)
|
||||
int rtmp;
|
||||
|
||||
/* suppress map display if some part of the code tries to update that */
|
||||
svp.program_state.restoring = REST_GSTATE;
|
||||
program_state.restoring = REST_GSTATE;
|
||||
|
||||
get_plname_from_file(nhfp, svp.plname);
|
||||
getlev(nhfp, 0, (xint8) 0);
|
||||
@@ -755,7 +755,7 @@ dorecover(NHFILE *nhfp)
|
||||
close_nhfile(nhfp);
|
||||
(void) delete_savefile();
|
||||
u.usteed_mid = u.ustuck_mid = 0;
|
||||
svp.program_state.restoring = 0;
|
||||
program_state.restoring = 0;
|
||||
return 0;
|
||||
}
|
||||
/* after restgamestate() -> restnames() so that 'bases[]' is populated */
|
||||
@@ -769,7 +769,7 @@ dorecover(NHFILE *nhfp)
|
||||
if (rtmp < 2)
|
||||
return rtmp; /* dorecover called recursively */
|
||||
|
||||
svp.program_state.restoring = REST_LEVELS;
|
||||
program_state.restoring = REST_LEVELS;
|
||||
|
||||
/* these pointers won't be valid while we're processing the
|
||||
* other levels, but they'll be reset again by restlevelstate()
|
||||
@@ -831,12 +831,12 @@ dorecover(NHFILE *nhfp)
|
||||
get_plname_from_file(nhfp, svp.plname);
|
||||
|
||||
/* not 0 nor REST_GSTATE nor REST_LEVELS */
|
||||
svp.program_state.restoring = REST_CURRENT_LEVEL;
|
||||
program_state.restoring = REST_CURRENT_LEVEL;
|
||||
|
||||
getlev(nhfp, 0, (xint8) 0);
|
||||
close_nhfile(nhfp);
|
||||
restlevelstate();
|
||||
svp.program_state.something_worth_saving = 1; /* useful data now exists */
|
||||
program_state.something_worth_saving = 1; /* useful data now exists */
|
||||
|
||||
if (!wizard && !discover)
|
||||
(void) delete_savefile();
|
||||
@@ -866,9 +866,9 @@ dorecover(NHFILE *nhfp)
|
||||
gv.vision_full_recalc = 1; /* recompute vision (not saved) */
|
||||
|
||||
run_timers(); /* expire all timers that have gone off while away */
|
||||
svp.program_state.restoring = 0; /* affects bot() so clear before docrt() */
|
||||
program_state.restoring = 0; /* affects bot() so clear before docrt() */
|
||||
|
||||
if (ge.early_raw_messages && !svp.program_state.beyond_savefile_load) {
|
||||
if (ge.early_raw_messages && !program_state.beyond_savefile_load) {
|
||||
/*
|
||||
* We're about to obliterate some potentially important
|
||||
* startup messages, so give the player a chance to see them.
|
||||
@@ -877,7 +877,7 @@ dorecover(NHFILE *nhfp)
|
||||
wait_synch();
|
||||
}
|
||||
u.usteed_mid = u.ustuck_mid = 0;
|
||||
svp.program_state.beyond_savefile_load = 1;
|
||||
program_state.beyond_savefile_load = 1;
|
||||
|
||||
docrt();
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
@@ -907,7 +907,7 @@ rest_stairs(NHFILE *nhfp)
|
||||
if (nhfp->structlevel) {
|
||||
Mread(nhfp->fd, &stway, sizeof stway);
|
||||
}
|
||||
if (svp.program_state.restoring != REST_GSTATE
|
||||
if (program_state.restoring != REST_GSTATE
|
||||
&& stway.tolev.dnum == u.uz.dnum) {
|
||||
/* stairway dlevel is relative, make it absolute */
|
||||
stway.tolev.dlevel += u.uz.dlevel;
|
||||
@@ -1012,7 +1012,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
||||
short tlev;
|
||||
#endif
|
||||
|
||||
svp.program_state.in_getlev = TRUE;
|
||||
program_state.in_getlev = TRUE;
|
||||
|
||||
if (ghostly)
|
||||
clear_id_mapping();
|
||||
@@ -1096,7 +1096,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
||||
if (nhfp->structlevel)
|
||||
Mread(nhfp->fd, trap, sizeof *trap);
|
||||
if (trap->tx != 0) {
|
||||
if (svp.program_state.restoring != REST_GSTATE
|
||||
if (program_state.restoring != REST_GSTATE
|
||||
&& trap->dst.dnum == u.uz.dnum) {
|
||||
/* convert relative destination to absolute */
|
||||
trap->dst.dlevel += u.uz.dlevel;
|
||||
@@ -1140,7 +1140,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
||||
}
|
||||
|
||||
/* regenerate monsters while on another level */
|
||||
if (!u.uz.dlevel || svp.program_state.restoring == REST_LEVELS)
|
||||
if (!u.uz.dlevel || program_state.restoring == REST_LEVELS)
|
||||
continue;
|
||||
if (ghostly) {
|
||||
/* reset peaceful/malign relative to new character;
|
||||
@@ -1242,7 +1242,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
||||
|
||||
if (ghostly)
|
||||
clear_id_mapping();
|
||||
svp.program_state.in_getlev = FALSE;
|
||||
program_state.in_getlev = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+2
-2
@@ -2204,7 +2204,7 @@ genl_player_setup(int screenheight)
|
||||
char pick4u = 'n';
|
||||
int result = 0; /* assume failure (player chooses to 'quit') */
|
||||
|
||||
svp.program_state.in_role_selection++; /* affects tty menu cleanup */
|
||||
program_state.in_role_selection++; /* affects tty menu cleanup */
|
||||
/* Used to avoid "Is this ok?" if player has already specified all
|
||||
* four facets of role.
|
||||
* Note that rigid_role_checks might force any unspecified facets to
|
||||
@@ -2704,7 +2704,7 @@ genl_player_setup(int screenheight)
|
||||
result = 1;
|
||||
|
||||
setup_done:
|
||||
svp.program_state.in_role_selection--;
|
||||
program_state.in_role_selection--;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -763,16 +763,16 @@ doconsult(struct monst *oracl)
|
||||
staticfn void
|
||||
couldnt_open_file(const char *filename)
|
||||
{
|
||||
int save_something = svp.program_state.something_worth_saving;
|
||||
int save_something = program_state.something_worth_saving;
|
||||
|
||||
/* most likely the file is missing, so suppress impossible()'s
|
||||
"saving and restoring might fix this" (unless the fuzzer,
|
||||
which escalates impossible to panic, is running) */
|
||||
if (!iflags.debug_fuzzer)
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
|
||||
impossible("Can't open '%s' file.", filename);
|
||||
svp.program_state.something_worth_saving = save_something;
|
||||
program_state.something_worth_saving = save_something;
|
||||
}
|
||||
|
||||
/* is 'word' a capitalized monster name that should be preceded by "the"?
|
||||
|
||||
+17
-17
@@ -41,7 +41,7 @@ staticfn void zerocomp_bputc(int);
|
||||
#endif
|
||||
|
||||
#if defined(HANGUPHANDLING)
|
||||
#define HUP if (!svp.program_state.done_hup)
|
||||
#define HUP if (!program_state.done_hup)
|
||||
#else
|
||||
#define HUP
|
||||
#endif
|
||||
@@ -59,7 +59,7 @@ dosave(void)
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
pline("Saving...");
|
||||
#if defined(HANGUPHANDLING)
|
||||
svp.program_state.done_hup = 0;
|
||||
program_state.done_hup = 0;
|
||||
#endif
|
||||
if (dosave0()) {
|
||||
u.uhp = -1; /* universal game's over indicator */
|
||||
@@ -86,7 +86,7 @@ dosave0(void)
|
||||
NHFILE *nhfp, *onhfp;
|
||||
int res = 0;
|
||||
|
||||
svp.program_state.saving++; /* inhibit status and perm_invent updates */
|
||||
program_state.saving++; /* inhibit status and perm_invent updates */
|
||||
/* we may get here via hangup signal, in which case we want to fix up
|
||||
a few of things before saving so that they won't be restored in
|
||||
an improper state; these will be no-ops for normal save sequence */
|
||||
@@ -103,7 +103,7 @@ dosave0(void)
|
||||
when punished, make sure ball and chain are placed too */
|
||||
done_object_cleanup(); /* maybe force some items onto map */
|
||||
|
||||
if (!svp.program_state.something_worth_saving || !gs.SAVEF[0])
|
||||
if (!program_state.something_worth_saving || !gs.SAVEF[0])
|
||||
goto done;
|
||||
|
||||
fq_save = fqname(gs.SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
||||
@@ -230,11 +230,11 @@ dosave0(void)
|
||||
delete_levelfile(0);
|
||||
nh_compress(fq_save);
|
||||
/* this should probably come sooner... */
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
res = 1;
|
||||
|
||||
done:
|
||||
svp.program_state.saving--;
|
||||
program_state.saving--;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ savegamestate(NHFILE *nhfp)
|
||||
{
|
||||
unsigned long uid;
|
||||
|
||||
svp.program_state.saving++; /* caller should/did already set this... */
|
||||
program_state.saving++; /* caller should/did already set this... */
|
||||
uid = (unsigned long) getuid();
|
||||
if (nhfp->structlevel) {
|
||||
bwrite(nhfp->fd, (genericptr_t) &uid, sizeof uid);
|
||||
@@ -338,7 +338,7 @@ savegamestate(NHFILE *nhfp)
|
||||
save_luadata(nhfp);
|
||||
if (nhfp->structlevel)
|
||||
bflush(nhfp->fd);
|
||||
svp.program_state.saving--;
|
||||
program_state.saving--;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ savestateinlock(void)
|
||||
char whynot[BUFSZ];
|
||||
NHFILE *nhfp;
|
||||
|
||||
svp.program_state.saving++; /* inhibit status and perm_invent updates */
|
||||
program_state.saving++; /* inhibit status and perm_invent updates */
|
||||
/* When checkpointing is on, the full state needs to be written
|
||||
* on each checkpoint. When checkpointing is off, only the pid
|
||||
* needs to be in the level.0 file, so it does not need to be
|
||||
@@ -385,7 +385,7 @@ savestateinlock(void)
|
||||
*/
|
||||
nhfp = open_levelfile(0, whynot);
|
||||
if (tricked_fileremoved(nhfp, whynot)) {
|
||||
svp.program_state.saving--;
|
||||
program_state.saving--;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ savestateinlock(void)
|
||||
than after so that screen updating behaves normally;
|
||||
game data shouldn't be inconsistent yet, unlike it would
|
||||
become midway through saving */
|
||||
svp.program_state.saving--;
|
||||
program_state.saving--;
|
||||
done(TRICKED);
|
||||
return;
|
||||
}
|
||||
@@ -433,7 +433,7 @@ savestateinlock(void)
|
||||
}
|
||||
close_nhfile(nhfp);
|
||||
}
|
||||
svp.program_state.saving--;
|
||||
program_state.saving--;
|
||||
gh.havestate = flags.ins_chkpt;
|
||||
return;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ savelev(NHFILE *nhfp, xint8 lev)
|
||||
but we'll be called during run-down */
|
||||
if (set_uz_save && perform_bwrite(nhfp)) {
|
||||
if (u.uz.dnum == 0 && u.uz.dlevel == 0) {
|
||||
svp.program_state.something_worth_saving = 0;
|
||||
program_state.something_worth_saving = 0;
|
||||
panic("savelev: where are we?");
|
||||
}
|
||||
gu.uz_save = u.uz;
|
||||
@@ -469,7 +469,7 @@ savelev_core(NHFILE *nhfp, xint8 lev)
|
||||
short tlev;
|
||||
#endif
|
||||
|
||||
svp.program_state.saving++; /* even if current mode is FREEING */
|
||||
program_state.saving++; /* even if current mode is FREEING */
|
||||
|
||||
if (!nhfp)
|
||||
panic("Save on bad file!"); /* impossible */
|
||||
@@ -564,7 +564,7 @@ savelev_core(NHFILE *nhfp, xint8 lev)
|
||||
if (nhfp->structlevel)
|
||||
bflush(nhfp->fd);
|
||||
}
|
||||
svp.program_state.saving--;
|
||||
program_state.saving--;
|
||||
if (release_data(nhfp)) {
|
||||
clear_level_structures();
|
||||
gf.ftrap = 0;
|
||||
@@ -717,7 +717,7 @@ save_stairs(NHFILE *nhfp)
|
||||
|
||||
while (stway) {
|
||||
if (perform_bwrite(nhfp)) {
|
||||
boolean use_relative = (svp.program_state.restoring != REST_GSTATE
|
||||
boolean use_relative = (program_state.restoring != REST_GSTATE
|
||||
&& stway->tolev.dnum == u.uz.dnum);
|
||||
if (use_relative) {
|
||||
/* make dlevel relative to current level */
|
||||
@@ -988,7 +988,7 @@ savetrapchn(NHFILE *nhfp, struct trap *trap)
|
||||
struct trap *trap2;
|
||||
|
||||
while (trap) {
|
||||
boolean use_relative = (svp.program_state.restoring != REST_GSTATE
|
||||
boolean use_relative = (program_state.restoring != REST_GSTATE
|
||||
&& trap->dst.dnum == u.uz.dnum);
|
||||
trap2 = trap->ntrap;
|
||||
if (use_relative)
|
||||
|
||||
+2
-2
@@ -194,7 +194,7 @@ bwrite(int fd, const genericptr_t loc, unsigned num)
|
||||
}
|
||||
if (failed) {
|
||||
#if defined(HANGUPHANDLING)
|
||||
if (svp.program_state.done_hup)
|
||||
if (program_state.done_hup)
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
else
|
||||
#endif
|
||||
@@ -230,7 +230,7 @@ mread(int fd, genericptr_t buf, unsigned len)
|
||||
} else {
|
||||
pline("Read %d instead of %u bytes.", (int) rlen, len);
|
||||
display_nhwindow(WIN_MESSAGE, TRUE); /* flush before error() */
|
||||
if (svp.program_state.restoring) {
|
||||
if (program_state.restoring) {
|
||||
(void) nhclose(fd);
|
||||
(void) delete_savefile();
|
||||
error("Error restoring old game.");
|
||||
|
||||
@@ -4908,7 +4908,7 @@ after_shk_move(struct monst *shkp)
|
||||
/* reset bill_p, need to re-calc player's occupancy too */
|
||||
eshkp->bill_p = &eshkp->bill[0];
|
||||
/* only re-check occupancy if game hasn't just ended */
|
||||
if (!svp.program_state.gameover)
|
||||
if (!program_state.gameover)
|
||||
check_special_room(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -865,7 +865,7 @@ shkname(struct monst *mtmp)
|
||||
} else {
|
||||
const char *shknm = ESHK(mtmp)->shknam;
|
||||
|
||||
if (Hallucination && !svp.program_state.gameover) {
|
||||
if (Hallucination && !program_state.gameover) {
|
||||
const char *const *nlp;
|
||||
int num;
|
||||
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@
|
||||
static long final_fpos; /* [note: do not move this to the 'g' struct] */
|
||||
#endif
|
||||
|
||||
#define done_stopprint svp.program_state.stopprint
|
||||
#define done_stopprint program_state.stopprint
|
||||
|
||||
#define newttentry() (struct toptenentry *) alloc(sizeof (struct toptenentry))
|
||||
#define dealloc_ttentry(ttent) free((genericptr_t) (ttent))
|
||||
@@ -642,7 +642,7 @@ topten(int how, time_t when)
|
||||
* topten uses alloc() several times, which will lead to
|
||||
* problems if the panic was the result of an alloc() failure.
|
||||
*/
|
||||
if (svp.program_state.panicking)
|
||||
if (program_state.panicking)
|
||||
return;
|
||||
|
||||
if (iflags.toptenwin) {
|
||||
@@ -650,7 +650,7 @@ topten(int how, time_t when)
|
||||
}
|
||||
|
||||
#if defined(HANGUPHANDLING)
|
||||
#define HUP if (!svp.program_state.done_hup)
|
||||
#define HUP if (!program_state.done_hup)
|
||||
#else
|
||||
#define HUP
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ clear_fcorr(struct monst *grd, boolean forceshow)
|
||||
coordxy fcx, fcy, fcbeg;
|
||||
struct monst *mtmp;
|
||||
boolean sawcorridor = FALSE,
|
||||
silently = svp.program_state.stopprint ? TRUE : FALSE;
|
||||
silently = program_state.stopprint ? TRUE : FALSE;
|
||||
struct egd *egrd = EGD(grd);
|
||||
struct trap *trap;
|
||||
struct rm *lev;
|
||||
|
||||
+3
-3
@@ -521,7 +521,7 @@ vision_recalc(int control)
|
||||
int oldseenv; /* previous seenv value */
|
||||
|
||||
gv.vision_full_recalc = 0; /* reset flag */
|
||||
if (gi.in_mklev || svp.program_state.in_getlev || !iflags.vision_inited)
|
||||
if (gi.in_mklev || program_state.in_getlev || !iflags.vision_inited)
|
||||
return;
|
||||
|
||||
/*
|
||||
@@ -825,9 +825,9 @@ vision_recalc(int control)
|
||||
/* This newsym() caused a crash delivering msg about failure to open
|
||||
* dungeon file init_dungeons() -> panic() -> done(11) ->
|
||||
* vision_recalc(2) -> newsym() -> crash! u.ux and u.uy are 0 and
|
||||
* svp.program_state.panicking == 1 under those circumstances
|
||||
* program_state.panicking == 1 under those circumstances
|
||||
*/
|
||||
if (!svp.program_state.panicking)
|
||||
if (!program_state.panicking)
|
||||
newsym(u.ux, u.uy); /* Make sure the hero shows up! */
|
||||
|
||||
/* Set the new min and max pointers. */
|
||||
|
||||
+3
-3
@@ -1814,7 +1814,7 @@ add_menu_heading(winid tmpwin, const char *buf)
|
||||
color = iflags.menu_headings.color;
|
||||
|
||||
/* suppress highlighting during end-of-game disclosure */
|
||||
if (svp.program_state.gameover)
|
||||
if (program_state.gameover)
|
||||
attr = ATR_NONE, color = NO_COLOR;
|
||||
|
||||
add_menu(tmpwin, &nul_glyphinfo, &any, '\0', '\0', attr, color,
|
||||
@@ -1862,10 +1862,10 @@ getlin(const char *query, char *bufp)
|
||||
{
|
||||
boolean old_bot_disabled = gb.bot_disabled;
|
||||
|
||||
svp.program_state.in_getlin = 1;
|
||||
program_state.in_getlin = 1;
|
||||
gb.bot_disabled = TRUE;
|
||||
(*windowprocs.win_getlin)(query, bufp);
|
||||
gb.bot_disabled = old_bot_disabled;
|
||||
svp.program_state.in_getlin = 0;
|
||||
program_state.in_getlin = 0;
|
||||
}
|
||||
/*windows.c*/
|
||||
|
||||
+2
-2
@@ -1435,7 +1435,7 @@ sanity_check(void)
|
||||
iflags.sanity_no_check = FALSE;
|
||||
return;
|
||||
}
|
||||
svp.program_state.in_sanity_check++;
|
||||
program_state.in_sanity_check++;
|
||||
you_sanity_check();
|
||||
obj_sanity_check();
|
||||
timer_sanity_check();
|
||||
@@ -1444,7 +1444,7 @@ sanity_check(void)
|
||||
bc_sanity_check();
|
||||
trap_sanity_check();
|
||||
engraving_sanity_check();
|
||||
svp.program_state.in_sanity_check--;
|
||||
program_state.in_sanity_check--;
|
||||
}
|
||||
|
||||
/* qsort() comparison routine for use in list_migrating_mons() */
|
||||
|
||||
Reference in New Issue
Block a user