Fix hero unhiding

maybe_unhide_at tried to handle both a monster and hero, but
hero being hidden is in u.uundetected flag, and the code was
only checking the monster mundetected field.

The code should probably be changed, either to change all uses
of the u.uundetected to gy.youmonster.mundetected, or perhaps
use a macro ... but these changes are all too big for me
to tackle for now.
This commit is contained in:
Pasi Kallinen
2023-02-08 17:08:20 +02:00
parent 6cc35abba3
commit 79f3491b21

View File

@@ -4128,10 +4128,15 @@ void
maybe_unhide_at(coordxy x, coordxy y)
{
struct monst *mtmp;
boolean undetected = FALSE;
if ((mtmp = m_at(x, y)) == 0 && u_at(x, y))
if ((mtmp = m_at(x, y)) == 0 && u_at(x, y)) {
mtmp = &gy.youmonst;
if (mtmp && mtmp->mundetected
undetected = u.uundetected;
} else {
undetected = mtmp->mundetected;
}
if (mtmp && undetected
&& ((hides_under(mtmp->data) && (!OBJ_AT(x, y) || mtmp->mtrapped))
|| (mtmp->data->mlet == S_EEL && !is_pool(x, y))))
(void) hideunder(mtmp);