]> granicus.if.org Git - nethack/commitdiff
unhiding during summoning
authornethack.rankin <nethack.rankin>
Sun, 22 Oct 2006 03:53:50 +0000 (03:53 +0000)
committernethack.rankin <nethack.rankin>
Sun, 22 Oct 2006 03:53:50 +0000 (03:53 +0000)
     According to a newsgroup followup, a hidden pet summoned via magic
whistle could produce the same effect as the level change case (where
sometimes the glyph for unseen monster would appear unexpectedly).  I was
unable to reproduce this one, but I don't see anything in the code to deal
with the situation, so I suspect that the monster is moving immediately
and being revealed before I have a chance to notice anything odd.

     I assume that other situations where hidden monsters get teleported
are being handled as attacks which expose them.  At least I hope so.

doc/fixes34.4
src/apply.c

index 2e0c416fc810a010caa6b4a5ac2e47ef5e42fb25..6e3348a1351bdacc144967672d491592a0193076 100644 (file)
@@ -263,7 +263,7 @@ try harder to keep dragged chain between ball and hero
 fireproof containers should not burn in lava
 fix invalid pointer dereference after applying a wielded cream pie
 avoid drowned in a drowning and burned by burning if life-saving is inadequate
-hidden monsters who change levels come out of hiding in the process
+reveal hidden monsters who change levels or are magically summoned
 
 
 Platform- and/or Interface-Specific Fixes
index bbe57d5a60f8ee4b3201e3697e1c936847936327..416c65f87429cc672632a07b5f714ea0f6b1f893 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)apply.c    3.5     2006/07/08      */
+/*     SCCS Id: @(#)apply.c    3.5     2006/10/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -409,7 +409,8 @@ struct obj *obj;
                    Underwater ? "very " : "");
                wake_nearby();
        } else {
-               int pet_cnt = 0;
+               int pet_cnt = 0, omx, omy;
+
                /* it's magic!  it works underwater too (at a higher pitch) */
                You(whistle_str, Hallucination ? "normal" :
                    Underwater ? "strange, high-pitched" : "strange");
@@ -422,9 +423,16 @@ struct obj *obj;
                            mtmp->mtrapped = 0;
                            fill_pit(mtmp->mx, mtmp->my);
                        }
+                       /* mimic must be revealed before we know whether it
+                          actually moves because line-of-sight may change */
+                       if (mtmp->m_ap_type) seemimic(mtmp);
+                       omx = mtmp->mx, omy = mtmp->my;
                        mnexto(mtmp);
-                       if (canspotmon(mtmp)) ++pet_cnt;
-                       if (mintrap(mtmp) == 2) change_luck(-1);
+                       if (mtmp->mx != omx || mtmp->my != omy) {
+                           mtmp->mundetected = 0; /* reveal non-mimic hider */
+                           if (canspotmon(mtmp)) ++pet_cnt;
+                           if (mintrap(mtmp) == 2) change_luck(-1);
+                       }
                    }
                }
                if (pet_cnt > 0) makeknown(obj->otyp);