unused variable: g.restoring

Get rid of the last reference to 'g.restoring' (which managed to
unintentionally survive the change to 'g.program_state.restoring').

Also have suppress_map_output() check 'g.program_state.saving' and
switch the couple of checks against that flag to use the function.
This commit is contained in:
PatR
2021-10-05 01:57:27 -07:00
parent ccfddd47de
commit 01cb9d312f
6 changed files with 11 additions and 12 deletions
-1
View File
@@ -1131,7 +1131,6 @@ struct instance_globals {
/* restore.c */ /* restore.c */
int n_ids_mapped; int n_ids_mapped;
struct bucket *id_map; struct bucket *id_map;
boolean restoring;
struct fruit *oldfruit; struct fruit *oldfruit;
long omoves; long omoves;
+3 -4
View File
@@ -249,8 +249,8 @@ bot(void)
{ {
/* dosave() flags completion by setting u.uhp to -1; supprss_map_output() /* dosave() flags completion by setting u.uhp to -1; supprss_map_output()
covers program_state.restoring and is used for status as well as map */ covers program_state.restoring and is used for status as well as map */
if (u.uhp != -1 && g.youmonst.data && iflags.status_updates if (u.uhp != -1 && g.youmonst.data
&& !g.program_state.saving && !suppress_map_output()) { && iflags.status_updates && !suppress_map_output()) {
if (VIA_WINDOWPORT()) { if (VIA_WINDOWPORT()) {
bot_via_windowport(); bot_via_windowport();
} else { } else {
@@ -273,8 +273,7 @@ timebot(void)
to skip update; suppress_map_output() handles program_state.restoring to skip update; suppress_map_output() handles program_state.restoring
and program_state.done_hup (tty hangup => no further output at all) and program_state.done_hup (tty hangup => no further output at all)
and we use it for maybe skipping status as well as for the map */ and we use it for maybe skipping status as well as for the map */
if (flags.time && iflags.status_updates if (flags.time && iflags.status_updates && !suppress_map_output()) {
&& !g.program_state.saving && !suppress_map_output()) {
if (VIA_WINDOWPORT()) { if (VIA_WINDOWPORT()) {
stat_update_time(); stat_update_time();
} else { } else {
-1
View File
@@ -580,7 +580,6 @@ const struct instance_globals g_init = {
/* restore.c */ /* restore.c */
0, /* n_ids_mapped */ 0, /* n_ids_mapped */
0, /* id_map */ 0, /* id_map */
FALSE, /* restoring */
UNDEFINED_PTR, /* oldfruit */ UNDEFINED_PTR, /* oldfruit */
UNDEFINED_VALUE, /* omoves */ UNDEFINED_VALUE, /* omoves */
+3 -3
View File
@@ -539,7 +539,7 @@ warning_of(struct monst *mon)
boolean boolean
suppress_map_output(void) suppress_map_output(void)
{ {
if (g.in_mklev || g.program_state.restoring) if (g.in_mklev || g.program_state.saving || g.program_state.restoring)
return TRUE; return TRUE;
#ifdef HANGUPHANDLING #ifdef HANGUPHANDLING
if (g.program_state.done_hup) if (g.program_state.done_hup)
@@ -1480,7 +1480,7 @@ redraw_map(void)
* !u.ux: display isn't ready yet; (restoring || !on_level()): was part * !u.ux: display isn't ready yet; (restoring || !on_level()): was part
* of cliparound() but interface shouldn't access this much internals * of cliparound() but interface shouldn't access this much internals
*/ */
if (!u.ux || g.restoring || !on_level(&u.uz0, &u.uz)) if (!u.ux || suppress_map_output() || !on_level(&u.uz0, &u.uz))
return; return;
/* /*
@@ -1829,7 +1829,7 @@ flush_screen(int cursor_on_u)
glyph_info bkglyphinfo = nul_glyphinfo; glyph_info bkglyphinfo = nul_glyphinfo;
/* 3.7: don't update map, status, or perm_invent during save/restore */ /* 3.7: don't update map, status, or perm_invent during save/restore */
if (g.program_state.saving || g.program_state.restoring) if (suppress_map_output())
return; return;
if (cursor_on_u == -1) if (cursor_on_u == -1)
+3 -3
View File
@@ -2346,12 +2346,12 @@ learn_unseen_invent(void)
/* persistent inventory window is maintained by interface code; /* persistent inventory window is maintained by interface code;
'update_inventory' used to be a macro for 'update_inventory' used to be a macro for
(*windowprocs.win_update_inventory) but the restore hackery (*windowprocs.win_update_inventory) but the restore hackery to suppress
was getting out of hand; this is now a central call point */ screen updates was getting out of hand; this is now a central call point */
void void
update_inventory(void) update_inventory(void)
{ {
if (g.program_state.saving || g.program_state.restoring) if (suppress_map_output()) /* despite name, used for perm_invent too */
return; return;
/* /*
+2
View File
@@ -756,7 +756,9 @@ dorecover(NHFILE* nhfp)
int rtmp; int rtmp;
struct obj *otmp; struct obj *otmp;
/* suppress map display if some part of the code tries to update that */
g.program_state.restoring = 1; g.program_state.restoring = 1;
get_plname_from_file(nhfp, g.plname); get_plname_from_file(nhfp, g.plname);
getlev(nhfp, 0, (xchar) 0); getlev(nhfp, 0, (xchar) 0);
if (!restgamestate(nhfp, &stuckid, &steedid)) { if (!restgamestate(nhfp, &stuckid, &steedid)) {