]> granicus.if.org Git - nethack/commitdiff
fix #H4179 - death reason for rotted globs
authorPatR <rankin@nethack.org>
Wed, 6 Jan 2016 01:29:36 +0000 (17:29 -0800)
committerPatR <rankin@nethack.org>
Wed, 6 Jan 2016 01:29:36 +0000 (17:29 -0800)
'Poisoned by a rotted gray ooze corpse' should have been
'Poisoned by a rotted glob of gray ooze'.

eatcorpse() is called for non-corpse globs and then corpse_xname()
is called for them too to set up death reason for make_sick(), but
it didn't know anything about globs.  Now it does.  Blob size is
ignored since it's not relevant for cause of death.

doc/fixes36.1
src/objnam.c

index 16f77f7e77a83ca45682e8daab11e5d9c18d21b8..dbbc0b0a6c82150c70979173d78f5a0a61aa7b45 100644 (file)
@@ -88,6 +88,7 @@ make mimics mimicing walls or trees also block light
 stepping onto lava destroyed non-fireproof water walking boots but left other
        vulnerable boot types intact
 allow moving cursor to monsters with 'm' and 'M' when asked for map location
+fix death reason when eating tainted glob of <monster> (not corpse)
 
 
 Platform- and/or Interface-Specific Fixes
index 339a478a5a96a842f7fbc975ca573351a8df1b44..5dc1e8c2e132813d00a8b4ebb80f2ab699531355 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 objnam.c        $NHDT-Date: 1451683056 2016/01/01 21:17:36 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.162 $ */
+/* NetHack 3.6 objnam.c        $NHDT-Date: 1452043772 2016/01/06 01:29:32 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.163 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1102,6 +1102,8 @@ register struct obj *otmp;
                           || is_flammable(otmp));
 }
 
+/* format a corpse name (xname() omits monster type; doname() calls us);
+   eatcorpse() also uses us for death reason when eating tainted glob */
 char *
 corpse_xname(otmp, adjective, cxn_flags)
 struct obj *otmp;
@@ -1118,10 +1120,14 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
             /* include "an" for "an ogre corpse */
         any_prefix = (cxn_flags & CXN_ARTICLE) != 0,
             /* leave off suffix (do_name() appends "corpse" itself) */
-        omit_corpse = (cxn_flags & CXN_NOCORPSE) != 0, possessive = FALSE;
+        omit_corpse = (cxn_flags & CXN_NOCORPSE) != 0,
+        possessive = FALSE,
+        glob = (otmp->otyp != CORPSE && otmp->globby);
     const char *mname;
 
-    if (omndx == NON_PM) { /* paranoia */
+    if (glob) {
+        mname = OBJ_NAME(objects[otmp->otyp]); /* "glob of <monster>" */
+    } else if (omndx == NON_PM) { /* paranoia */
         mname = "thing";
         /* [Possible enhancement:  check whether corpse has monster traits
             attached in order to use priestname() for priests and minions.] */
@@ -1172,7 +1178,9 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
             any_prefix = FALSE;
     }
 
-    if (!omit_corpse) {
+    if (glob) {
+        ; /* omit_corpse doesn't apply; quantity is always 1 */
+    } else if (!omit_corpse) {
         Strcat(nambuf, " corpse");
         /* makeplural(nambuf) => append "s" to "corpse" */
         if (otmp->quan > 1L && !ignore_quan) {