impossible "ceiling hider hiding without ceiling"

Reported by a hardfought user, a ceiling_hider monster hid on the
Astral level, triggering a sanity check warning that gets repeated
each move until the hider comes out of hiding.  Normally sanity_check
can only be set in wizard mode, but hardfought must force it on for
to-be-3.7.

I was able to reproduce it before this fix and unable to do so
afterward, but there is a random factor involved hence no guarantees.
I think that lack of ceiling for Astral is recent, but this could
have happened on other levels which lack a ceiling.  I didn't try to
figure out whether it might happen with 3.6.x, just put the fixes
entry in the "exposed by git" (found in code not yet released, that
is) section.
This commit is contained in:
PatR
2023-09-21 14:17:01 -07:00
parent 0c2004c0d1
commit c868feb383
2 changed files with 5 additions and 0 deletions

View File

@@ -4214,6 +4214,9 @@ restrap(struct monst *mtmp)
/* can't hide while trapped except in pits */
|| (mtmp->mtrapped && (t = t_at(mtmp->mx, mtmp->my)) != 0
&& !is_pit(t->ttyp))
/* can't hide on ceiling if there isn't one */
|| (ceiling_hider(mtmp->data) && !has_ceiling(&u.uz))
/* won't hide when adjacent to hero */
|| (sensemon(mtmp) && next2u(mtmp->mx, mtmp->my)))
return FALSE;