fix #K3436 - crash during restore

triggered by Grayswandir's hallucination resistance.  If the game
is saved while hero is hallucinating but having that be suppressed
by wielding Grayswandir, is riding, and the steed is on an object,
then during restore the hero's location will be updated because
of the presence of the object but the attempt to display the hero
there is made before u.usteed has been restored and fails.
This commit is contained in:
PatR
2021-09-05 15:44:00 -07:00
parent e813cf5b05
commit 9f230c3cd4
4 changed files with 44 additions and 8 deletions

View File

@@ -529,6 +529,20 @@ warning_of(struct monst *mon)
return wl;
}
/* map or status window might not be ready for output during level creation
or game restoration (something like u.usteed which affects display of
the hero and also a status condition might not be set up yet) */
boolean
suppress_map_output(void)
{
if (g.in_mklev || g.program_state.restoring)
return TRUE;
#ifdef HANGUPHANDLING
if (g.program_state.done_hup)
return TRUE;
#endif
return FALSE;
}
/*
* feel_newsym()
@@ -562,6 +576,10 @@ feel_location(xchar x, xchar y)
struct obj *boulder;
register struct monst *mon;
/* replicate safeguards used by newsym(); might not be required here */
if (suppress_map_output())
return;
if (!isok(x, y))
return;
lev = &(levl[x][y]);
@@ -721,12 +739,9 @@ newsym(register int x, register int y)
boolean worm_tail;
register struct rm *lev = &(levl[x][y]);
if (g.in_mklev)
/* don't try to produce map output when level is in a state of flux */
if (suppress_map_output())
return;
#ifdef HANGUPHANDLING
if (g.program_state.done_hup)
return;
#endif
/* only permit updating the hero when swallowed */
if (u.uswallow) {