]> granicus.if.org Git - nethack/commitdiff
fix bz 12 - long worm inventory feedback
authorPatR <rankin@nethack.org>
Fri, 26 Feb 2016 22:37:07 +0000 (14:37 -0800)
committerPatR <rankin@nethack.org>
Fri, 26 Feb 2016 22:37:07 +0000 (14:37 -0800)
I initially misunderstood this bug report about a nymph who was
polymorphed into a long worm while carrying a cursed figurine.
It wasn't about a long worm having inventory or about probing of
the worm's tail revealing that it had inventory, it was about the
message given when the cursed figurine activated itself.  If that
happened while the head was out of view but at least one tail
segment was visible, the message about the new monster emerging
from the long worm's backpack implied that that pack was carried
by the tail segment.

Only give the emerge-from-backpack message when the worm's head
is visible.  Likewise if a carried egg hatches.

doc/fixes36.1
src/apply.c
src/timeout.c

index 2a1cd5d77f86cc86a93f0d8e4655dbd290da800c..4a94030682bfd4d26367fe3eb2355791d7308a25 100644 (file)
@@ -165,6 +165,10 @@ when examining hidden monsters (probing, persistent monster detection), tell
 some quest text corrections
 use a much tighter upper bound when summoning nasties; old method could
        theoretically create 200 critters at a time
+if a long worm inherited inventory from a previous shape, and if an egg or
+       figurine in that inventory hatched or auto-activated, messages were
+       given when hero could see any tail segment even if head was unseen,
+       making it seem as if worm's inventory was kept in the visible segment
 
 
 Platform- and/or Interface-Specific Fixes
index e993db8344bc26ccd568721977a3d7f227cc548d..2af9d245d2e29bf166b9229a645fd4a0a40b6b69 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 apply.c $NHDT-Date: 1455140802 2016/02/10 21:46:42 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.220 $ */
+/* NetHack 3.6 apply.c $NHDT-Date: 1456526104 2016/02/26 22:35:04 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.221 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1966,8 +1966,8 @@ long timeout;
     if (mtmp) {
         char and_vanish[BUFSZ];
         struct obj *mshelter = level.objects[mtmp->mx][mtmp->my];
-        Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
 
+        Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
         and_vanish[0] = '\0';
         if ((mtmp->minvis && !See_invisible)
             || (mtmp->data->mlet == S_MIMIC
@@ -2009,11 +2009,13 @@ long timeout;
         case OBJ_MINVENT:
             if (cansee_spot && !silent && !suppress_see) {
                 struct monst *mon;
+
                 mon = figurine->ocarry;
                 /* figurine carrying monster might be invisible */
-                if (canseemon(figurine->ocarry)) {
+                if (canseemon(figurine->ocarry)
+                    && (!mon->wormno || cansee(mon->mx, mon->my)))
                     Sprintf(carriedby, "%s pack", s_suffix(a_monnam(mon)));
-                else if (is_pool(mon->mx, mon->my))
+                else if (is_pool(mon->mx, mon->my))
                     Strcpy(carriedby, "empty water");
                 else
                     Strcpy(carriedby, "thin air");
index 7370b8b05c044e7f84a4d4f7915e0cc04d7426ce..cb93622d75f3a7c0620c877fc69134018b533997 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 timeout.c       $NHDT-Date: 1452660198 2016/01/13 04:43:18 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.64 $ */
+/* NetHack 3.6 timeout.c       $NHDT-Date: 1456526165 2016/02/26 22:36:05 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.65 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -614,14 +614,17 @@ long timeout;
         case OBJ_MINVENT:
             if (cansee_hatchspot) {
                 /* egg carrying monster might be invisible */
-                if (canseemon(egg->ocarry)) {
+                mon2 = egg->ocarry;
+                if (canseemon(mon2)
+                    && (!mon2->wormno || cansee(mon2->mx, mon2->my))) {
                     Sprintf(carriedby, "%s pack",
-                            s_suffix(a_monnam(egg->ocarry)));
+                            s_suffix(a_monnam(mon2)));
                     knows_egg = TRUE;
-                } else if (is_pool(mon->mx, mon->my))
+                } else if (is_pool(mon->mx, mon->my)) {
                     Strcpy(carriedby, "empty water");
-                else
+                } else {
                     Strcpy(carriedby, "thin air");
+                }
                 You_see("%s %s out of %s!", monnambuf,
                         locomotion(mon->data, "drop"), carriedby);
             }