]> granicus.if.org Git - nethack/commitdiff
fix #H254 - stethocoping mimics (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 8 Mar 2007 05:42:15 +0000 (05:42 +0000)
committernethack.rankin <nethack.rankin>
Thu, 8 Mar 2007 05:42:15 +0000 (05:42 +0000)
     From a bug report, applying a stetoscope to
a mimic which was hiding would report that mimic's stats but not bring it
out of hiding, unlike the behavior for other types of hiding monsters.

doc/fixes35.0
src/apply.c

index 5a8d683a24a15770c13fa6bbd1823e20a58bc3c8..835d4f18aae8db10bce63f68f80a0d27dfee0b35 100644 (file)
@@ -193,6 +193,7 @@ scatter piles of kicked gold rather than move the entire pile at once
 if normal game save file is restored via `nethack -X', restore in normal
        mode--with save file deletion--and require confirmation ala 'X'
        command to make deferred switch into explore mode
+stethoscope applied to hiding mimic will bring it out of hiding
 
 
 Platform- and/or Interface-Specific Fixes
index 5830b441063c5953b508c8087eb74951bff88f5c..b899937f73dc1fcb8ed6f15e09856012428558d6 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)apply.c    3.5     2007/02/03      */
+/*     SCCS Id: @(#)apply.c    3.5     2007/03/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -344,11 +344,34 @@ use_stethoscope(obj)
                return 0;
        }
        if ((mtmp = m_at(rx,ry)) != 0) {
-               mstatusline(mtmp);
+               const char *mnm = x_monnam(mtmp, ARTICLE_A, (const char *)0,
+                                       SUPPRESS_IT|SUPPRESS_INVISIBLE, FALSE);
+
                if (mtmp->mundetected) {
-                       mtmp->mundetected = 0;
-                       if (cansee(rx,ry)) newsym(mtmp->mx,mtmp->my);
+                   if (!canspotmon(mtmp))
+                       There("is %s hidden there.", mnm);
+                   mtmp->mundetected = 0;
+                   newsym(mtmp->mx, mtmp->my);
+               } else if (mtmp->mappearance) {
+                   const char *what = "thing";
+
+                   switch (mtmp->m_ap_type) {
+                   case M_AP_OBJECT:
+                       what = simple_typename(mtmp->mappearance);
+                       break;
+                   case M_AP_MONSTER:  /* ignore Hallucination here */
+                       what = mons[mtmp->mappearance].mname;
+                       break;
+                   case M_AP_FURNITURE:
+                       what = defsyms[mtmp->mappearance].explanation;
+                       break;
+                   }
+                   seemimic(mtmp);
+                   pline("That %s is really %s", what, mnm);
+               } else if (flags.verbose && !canspotmon(mtmp)) {
+                   There("is %s there.", mnm);
                }
+               mstatusline(mtmp);
                if (!canspotmon(mtmp))
                        map_invisible(rx,ry);
                return res;