follow-up, program_state

This commit is contained in:
nhmall
2024-07-13 16:31:35 -04:00
parent 72d2b0414c
commit 0eb7f109e0
67 changed files with 255 additions and 252 deletions

View File

@@ -193,7 +193,7 @@ nhmain(int argc, char *argv[])
* It seems you really want to play.
*/
u.uhp = 1; /* prevent RIP on early quits */
svp.program_state.preserve_locks = 1;
program_state.preserve_locks = 1;
#ifndef NO_SIGNAL
sethanguphandler((SIG_RET_TYPE) hangup);
#endif
@@ -272,7 +272,7 @@ nhmain(int argc, char *argv[])
*/
if (*svp.plname) {
getlock();
svp.program_state.preserve_locks = 0; /* after getlock() */
program_state.preserve_locks = 0; /* after getlock() */
}
if (*svp.plname && (nhfp = restore_saved_game()) != 0) {

View File

@@ -794,7 +794,7 @@ vesa_cliparound(int x, int y)
clipymax = ROWNO - 1;
}
if (clipx != oldx || clipy != oldy) {
if (on_level(&u.uz0, &u.uz) && !svp.program_state.restoring)
if (on_level(&u.uz0, &u.uz) && !program_state.restoring)
/* (void) doredraw(); */
vesa_redrawmap();
}

View File

@@ -472,7 +472,7 @@ vga_cliparound(int x, int y UNUSED)
clipx = clipxmax - (viewport_size - 1);
}
if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !svp.program_state.restoring)
if (on_level(&u.uz0, &u.uz) && !program_state.restoring)
/* (void) doredraw(); */
vga_redrawmap(1);
}

View File

@@ -164,7 +164,7 @@ main(int argc, char *argv[])
*/
u.uhp = 1; /* prevent RIP on early quits */
#if defined(HANGUPHANDLING)
svp.program_state.preserve_locks = 1;
program_state.preserve_locks = 1;
#ifndef NO_SIGNAL
sethanguphandler((SIG_RET_TYPE) hangup);
#endif
@@ -239,7 +239,7 @@ main(int argc, char *argv[])
if (*svp.plname) {
getlock();
#if defined(HANGUPHANDLING)
svp.program_state.preserve_locks = 0; /* after getlock() */
program_state.preserve_locks = 0; /* after getlock() */
#endif
}
@@ -276,8 +276,8 @@ main(int argc, char *argv[])
}
}
}
if (svp.program_state.in_self_recover) {
svp.program_state.in_self_recover = FALSE;
if (program_state.in_self_recover) {
program_state.in_self_recover = FALSE;
}
}

View File

@@ -82,7 +82,7 @@ eraseoldlocks(void)
int i;
#if defined(HANGUPHANDLING)
svp.program_state.preserve_locks = 0; /* not required but shows intent */
program_state.preserve_locks = 0; /* not required but shows intent */
/* cannot use maxledgerno() here, because we need to find a lock name
* before starting everything (including the dungeon initialization
* that sets astral_level, needed for maxledgerno()) up
@@ -216,7 +216,7 @@ getlock(void)
}
#ifdef SELF_RECOVER
if (c == 'r' || c == 'R') {
if (recover_savefile() && svp.program_state.in_self_recover) {
if (recover_savefile() && program_state.in_self_recover) {
set_levelfile_name(gl.lock, 0);
fq_lock = fqname(gl.lock, LEVELPREFIX, 0);
goto gotlock;

View File

@@ -412,7 +412,7 @@ byebye(void)
(void) sys$delprc(&mail_pid, (genericptr_t) 0), mail_pid = 0;
#endif
#ifdef FREE_ALL_MEMORY
if (progname && !svp.program_state.panicking) {
if (progname && !program_state.panicking) {
if (gh.hname == progname)
gh.hname = (char *) 0;
free((genericptr_t) progname), progname = (char *) 0;
@@ -421,7 +421,7 @@ byebye(void)
/* SIGHUP doesn't seem to do anything on VMS, so we fudge it here... */
hup = (void (*)(int)) signal(SIGHUP, SIG_IGN);
if (!svp.program_state.exiting++
if (!program_state.exiting++
&& hup != (void (*)(int)) SIG_DFL
&& hup != (void (*)(int)) SIG_IGN) {
(*hup)(SIGHUP);
@@ -446,7 +446,7 @@ genericptr_t mechargs) /* [0] is argc, [1..argc] are the real args */
if (condition == SS$_ACCVIO /* access violation */
|| (condition >= SS$_ASTFLT && condition <= SS$_TBIT)
|| (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) {
svp.program_state.done_hup = TRUE; /* pretend hangup has been attempted */
program_state.done_hup = TRUE; /* pretend hangup has been attempted */
#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED)
if (wizard)
#endif

View File

@@ -158,7 +158,7 @@ vms_getchar(void)
static volatile int recurse = 0; /* SMG is not AST re-entrant! */
#endif
if (svp.program_state.done_hup) {
if (program_state.done_hup) {
/* hangup has occurred; do not attempt to get further user input */
return ESC;
}

View File

@@ -936,7 +936,7 @@ void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y)
while (dst != sentinel)
*dst++ = *fill;
if ((iflags.debug.immediateflips || !svp.program_state.in_moveloop)
if ((iflags.debug.immediateflips || !program_state.in_moveloop)
&& buffer == console.back_buffer)
back_buffer_flip();
}
@@ -952,7 +952,7 @@ static void buffer_clear_to_end_of_line(cell_t * buffer, int x, int y)
while (dst != sentinel)
*dst++ = clear_cell;
if (iflags.debug.immediateflips || !svp.program_state.in_moveloop)
if (iflags.debug.immediateflips || !program_state.in_moveloop)
back_buffer_flip();
}
@@ -964,7 +964,7 @@ void buffer_write(cell_t * buffer, cell_t * cell, COORD pos)
cell_t * dst = buffer + (console.width * pos.Y) + pos.X;
*dst = *cell;
if ((iflags.debug.immediateflips || !svp.program_state.in_moveloop)
if ((iflags.debug.immediateflips || !program_state.in_moveloop)
&& buffer == console.back_buffer)
back_buffer_flip();
}
@@ -1149,7 +1149,7 @@ tgetch(void)
numpad |= 0x10;
#endif
return (svp.program_state.done_hup)
return (program_state.done_hup)
? '\033'
: keyboard_handling.pCheckInput(
console.hConIn, &ir, &count, numpad, 0, &mod, &cc);
@@ -1177,7 +1177,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
if (gc.Cmd.swap_yz)
numpad |= 0x10;
#endif
ch = (svp.program_state.done_hup)
ch = (program_state.done_hup)
? '\033'
: keyboard_handling.pCheckInput(
console.hConIn, &ir, &count, numpad, 1, mod, &cc);

View File

@@ -771,8 +771,8 @@ attempt_restore:
}
}
}
if (svp.program_state.in_self_recover) {
svp.program_state.in_self_recover = FALSE;
if (program_state.in_self_recover) {
program_state.in_self_recover = FALSE;
set_savefile_name(TRUE);
}
}