move 'g.restoring' to 'g.program_state.restoring'

Move the core's global restoring flag (not the same as main()'s
local resuming flag) to a more logical place.  Add a saving flag
in the process, but it isn't being set or cleared anywhere yet.
(Once in use it will probably fix the exception during save that
was just reported, but before that it would be useful to figure
out what specifically caused the event.)

The program_state struct really ought to be standalone rather
than part of struct g but I haven't made that change.

Removing an unused variable for wishing and some reformatting
that whent along with it got mixed in.  Removes some trailing
whitespace in sfstruct.c too.

Only lightly tested...
This commit is contained in:
PatR
2020-11-30 11:40:21 -08:00
parent 30b59acc40
commit f8fcab3400
10 changed files with 59 additions and 47 deletions

View File

@@ -76,7 +76,6 @@ extern int attrib_text_normal; /* text mode normal attribute */
extern int attrib_gr_normal; /* graphics mode normal attribute */
extern int attrib_gr_intense; /* graphics mode intense attribute */
extern boolean inmap; /* in the map window */
/* extern boolean g.restoring; */
/*
* Global Variables
@@ -786,7 +785,7 @@ int x, y;
clipymax = ROWNO - 1;
}
if (clipx != oldx || clipy != oldy) {
if (on_level(&u.uz0, &u.uz) && !g.restoring)
if (on_level(&u.uz0, &u.uz) && !g.program_state.restoring)
/* (void) doredraw(); */
vesa_redrawmap();
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 vidvga.c $NHDT-Date: 1596498278 2020/08/03 23:44:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.7 vidvga.c $NHDT-Date: 1606765216 2020/11/30 19:40:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.26 $ */
/* Copyright (c) NetHack PC Development Team 1995 */
/* NetHack may be freely redistributed. See license for details. */
/*
@@ -430,7 +430,6 @@ static void
vga_cliparound(x, y)
int x, y;
{
/* extern boolean g.restoring; */
int oldx = clipx;
if (!iflags.tile_view || iflags.over_view || iflags.traditional_view)
@@ -444,7 +443,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1);
}
if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !g.restoring)
if (on_level(&u.uz0, &u.uz) && !g.program_state.restoring)
/* (void) doredraw(); */
vga_redrawmap(1);
}