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

View File

@@ -1131,7 +1131,6 @@ struct instance_globals {
/* restore.c */
int n_ids_mapped;
struct bucket *id_map;
boolean restoring;
struct fruit *oldfruit;
long omoves;

View File

@@ -249,8 +249,8 @@ bot(void)
{
/* 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 */
if (u.uhp != -1 && g.youmonst.data && iflags.status_updates
&& !g.program_state.saving && !suppress_map_output()) {
if (u.uhp != -1 && g.youmonst.data
&& iflags.status_updates && !suppress_map_output()) {
if (VIA_WINDOWPORT()) {
bot_via_windowport();
} else {
@@ -273,8 +273,7 @@ timebot(void)
to skip update; suppress_map_output() handles program_state.restoring
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 */
if (flags.time && iflags.status_updates
&& !g.program_state.saving && !suppress_map_output()) {
if (flags.time && iflags.status_updates && !suppress_map_output()) {
if (VIA_WINDOWPORT()) {
stat_update_time();
} else {

View File

@@ -580,7 +580,6 @@ const struct instance_globals g_init = {
/* restore.c */
0, /* n_ids_mapped */
0, /* id_map */
FALSE, /* restoring */
UNDEFINED_PTR, /* oldfruit */
UNDEFINED_VALUE, /* omoves */

View File

@@ -539,7 +539,7 @@ warning_of(struct monst *mon)
boolean
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;
#ifdef HANGUPHANDLING
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
* 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;
/*
@@ -1829,7 +1829,7 @@ flush_screen(int cursor_on_u)
glyph_info bkglyphinfo = nul_glyphinfo;
/* 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;
if (cursor_on_u == -1)

View File

@@ -2346,12 +2346,12 @@ learn_unseen_invent(void)
/* persistent inventory window is maintained by interface code;
'update_inventory' used to be a macro for
(*windowprocs.win_update_inventory) but the restore hackery
was getting out of hand; this is now a central call point */
(*windowprocs.win_update_inventory) but the restore hackery to suppress
screen updates was getting out of hand; this is now a central call point */
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;
/*

View File

@@ -756,7 +756,9 @@ dorecover(NHFILE* nhfp)
int rtmp;
struct obj *otmp;
/* suppress map display if some part of the code tries to update that */
g.program_state.restoring = 1;
get_plname_from_file(nhfp, g.plname);
getlev(nhfp, 0, (xchar) 0);
if (!restgamestate(nhfp, &stuckid, &steedid)) {