]> granicus.if.org Git - nethack/commitdiff
Fix hero unhiding
authorPasi Kallinen <paxed@alt.org>
Wed, 8 Feb 2023 15:08:20 +0000 (17:08 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 8 Feb 2023 15:10:27 +0000 (17:10 +0200)
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.

src/mon.c

index 53bbc7508e6b3f2e96140b6555f711a5fcd99c16..fa6d3581a99c6a5af60da43764e6ae9fc3feb2d5 100644 (file)
--- 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);