From: Pasi Kallinen Date: Wed, 8 Feb 2023 15:08:20 +0000 (+0200) Subject: Fix hero unhiding X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79f3491b21081e6d2ae2118c6d680c2150ca110d;p=nethack 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. --- diff --git a/src/mon.c b/src/mon.c index 53bbc7508..fa6d3581a 100644 --- a/src/mon.c +++ b/src/mon.c @@ -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);