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

@@ -232,7 +232,7 @@ xwaitforspace(const char *s) /* chars allowed besides return */
morc = 0;
while (
#ifdef HANGUPHANDLING
!svp.program_state.done_hup &&
!program_state.done_hup &&
#endif
(c = tty_nhgetch()) != EOF) {
if (c == '\n' || c == '\r')

View File

@@ -184,7 +184,7 @@ remember_topl(void)
cw->datlen[idx] = (short) len;
}
Strcpy(cw->data[idx], gt.toplines);
if (!svp.program_state.in_checkpoint) {
if (!program_state.in_checkpoint) {
*gt.toplines = '\0';
cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
}

View File

@@ -84,7 +84,7 @@ extern void msmsg(const char *, ...);
*/
#define HUPSKIP() \
do { \
if (svp.program_state.done_hup) { \
if (program_state.done_hup) { \
morc = '\033'; \
return; \
} \
@@ -92,7 +92,7 @@ extern void msmsg(const char *, ...);
/* morc=ESC - in case we bypass xwaitforspace() which sets that */
#define HUPSKIP_RESULT(RES) \
do { \
if (svp.program_state.done_hup) \
if (program_state.done_hup) \
return (RES); \
} while (0)
#else /* !HANGUPHANDLING */
@@ -376,11 +376,11 @@ winch_handler(int sig_unused UNUSED)
}
#endif
svp.program_state.resize_pending++; /* resize_tty() will reset it */
program_state.resize_pending++; /* resize_tty() will reset it */
/* if nethack is waiting for input, which is the most likely scenario,
we will go ahead and respond to the resize immediately; otherwise,
tty_nhgetch() will do so the next time it's called */
if (svp.program_state.getting_char) {
if (program_state.getting_char) {
resize_tty();
#if 0 /* [this doesn't work as intended and seems to be unnecessary] */
if (resize_mesg) {
@@ -402,7 +402,7 @@ resize_tty(void)
struct WinDesc *cw;
/* reset to 0 rather than just decrement */
svp.program_state.resize_pending = 0;
program_state.resize_pending = 0;
resize_mesg = 0;
getwindowsz(); /* update LI and CO */
@@ -1978,7 +1978,7 @@ tty_dismiss_nhwindow(winid window)
can't refresh--force the screen to be cleared instead
(affects dismissal of 'reset role filtering' menu if
screen height forces that to need a second page) */
if (svp.program_state.in_role_selection)
if (program_state.in_role_selection)
clearscreen = TRUE;
erase_menu_or_text(window, cw, clearscreen);
@@ -3041,7 +3041,7 @@ ttyinv_add_menu(
: !show_gold ? 26
: 27);
if (!svp.program_state.in_moveloop)
if (!program_state.in_moveloop)
return;
slot = selector_to_slot(ch, ttyinvmode, &ignore);
if (inuse_only && slot > 2 * rows_per_side)
@@ -3216,7 +3216,7 @@ ttyinv_end_menu(int window, struct WinDesc *cw)
{
if (iflags.perm_invent
|| gp.perm_invent_toggling_direction == toggling_on) {
if (svp.program_state.in_moveloop) {
if (program_state.in_moveloop) {
boolean inuse_only = ((ttyinvmode & InvInUse) != 0);
int rows_per_side = inuse_only ? cw->maxrow - 2 : 0;
int old_slots_used = ttyinv_slots_used; /* value before render */
@@ -3245,7 +3245,7 @@ ttyinv_render(winid window, struct WinDesc *cw)
uint32 current_row_color = NO_COLOR;
struct tty_perminvent_cell *cell;
char invbuf[BUFSZ];
boolean force_redraw = svp.program_state.in_docrt ? TRUE : FALSE,
boolean force_redraw = program_state.in_docrt ? TRUE : FALSE,
inuse_only = (ttyinvmode & InvInUse) != 0,
show_gold = (ttyinvmode & InvShowGold) != 0 && !inuse_only,
sparse = (ttyinvmode & InvSparse) != 0 && !inuse_only;
@@ -3603,7 +3603,7 @@ tty_wait_synch(void)
if (ttyDisplay->inmore) {
addtopl("--More--");
(void) fflush(stdout);
} else if (ttyDisplay->inread > svp.program_state.gameover) {
} else if (ttyDisplay->inread > program_state.gameover) {
/* this can only happen if we were reading and got interrupted */
ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
/* do this twice; 1st time gets the Quit? message again */
@@ -4036,19 +4036,19 @@ tty_nhgetch(void)
i = randomkey();
} else {
#ifdef RESIZABLE
if (svp.program_state.resize_pending)
if (program_state.resize_pending)
resize_tty();
#endif
svp.program_state.getting_char++;
program_state.getting_char++;
#ifdef UNIX
i = (svp.program_state.getting_char == 1)
i = (program_state.getting_char == 1)
? tgetch()
: ((read(fileno(stdin), (genericptr_t) &nestbuf, 1) == 1)
? (int) nestbuf : EOF);
#else
i = tgetch();
#endif
svp.program_state.getting_char--;
program_state.getting_char--;
#ifdef RESIZABLE
if (resize_mesg) {
resize_mesg = 0;