]> granicus.if.org Git - nethack/commitdiff
bones bit: crysknife vs green slime
authorPatR <rankin@nethack.org>
Sun, 5 May 2019 21:48:43 +0000 (14:48 -0700)
committerPatR <rankin@nethack.org>
Sun, 5 May 2019 21:48:43 +0000 (14:48 -0700)
Being turned into green slime never drops hero's inventory so invent
objects shouldn't be subject to obj_not_held() handling.

obj_not_held() does apply to undead.  Arising as a mummy or vampire
doesn't go through the trouble of dropping everything and picking it
back up, but there is a point in the die...arise sequence where the
hero is implicitly a corpse so nobody is holding his/her stuff.

doc/fixes36.2
src/bones.c

index 7b791a6b7936e847ab1507355fc34d3545165052..c7fa21534e4877fb969aede7210e08b439b7d7e3 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.312 $ $NHDT-Date: 1556649298 2019/04/30 18:34:58 $
+$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.315 $ $NHDT-Date: 1557091781 2019/05/05 21:29:41 $
 
 This fixes36.2 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -424,6 +424,8 @@ poly'd hero capable of spitting venom would leave intact venom object if it
 avoid impossible if monster cannot be relocated from teleport region
 fix cloned monster trapped and hiding states
 split monster could be placed on trap without triggering it
+turning into green slime would make wielded or carried crysknives revert to
+       worm teeth in bones data even though they remained carried
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index 7aadc39671cc310c330b0707b10055ad5c125acb..0a7b8179360b081b2f95a0253da9d99c47381ed9 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 bones.c $NHDT-Date: 1539653203 2018/10/16 01:26:43 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.73 $ */
+/* NetHack 3.6 bones.c $NHDT-Date: 1557092711 2019/05/05 21:45:11 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.75 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -214,8 +214,8 @@ char *namebuf;
 /* called by savebones(); also by finish_paybill(shk.c) */
 void
 drop_upon_death(mtmp, cont, x, y)
-struct monst *mtmp;
-struct obj *cont;
+struct monst *mtmp; /* monster if hero turned into one (other than ghost) */
+struct obj *cont; /* container if hero is turned into a statue */
 int x, y;
 {
     struct obj *otmp;
@@ -223,9 +223,13 @@ int x, y;
     u.twoweap = 0; /* ensure curse() won't cause swapwep to drop twice */
     while ((otmp = invent) != 0) {
         obj_extract_self(otmp);
-        obj_no_longer_held(otmp);
+        /* when turning into green slime, all gear remains held;
+           other types "arise from the dead" do aren't holding
+           equipment during their brief interval as a corpse */
+        if (!mtmp || is_undead(mtmp->data))
+            obj_no_longer_held(otmp);
 
-        otmp->owornmask = 0;
+        otmp->owornmask = 0L;
         /* lamps don't go out when dropped */
         if ((cont || artifact_light(otmp)) && obj_is_burning(otmp))
             end_burn(otmp, TRUE); /* smother in statue */
@@ -365,7 +369,7 @@ struct obj *corpse;
         return;
     }
 
-make_bones:
+ make_bones:
     unleash_all();
     /* in case these characters are not in their home bases */
     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -390,7 +394,7 @@ make_bones:
 
     /* check iron balls separately--maybe they're not carrying it */
     if (uball)
-        uball->owornmask = uchain->owornmask = 0;
+        uball->owornmask = uchain->owornmask = 0L;
 
     /* dispose of your possessions, usually cursed */
     if (u.ugrave_arise == (NON_PM - 1)) {
@@ -422,21 +426,21 @@ make_bones:
         in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
         mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT);
         in_mklev = FALSE;
-        if (!mtmp) {
+        if (!mtmp) { /* arise-type might have been genocided */
             drop_upon_death((struct monst *) 0, (struct obj *) 0, u.ux, u.uy);
             u.ugrave_arise = NON_PM; /* in case caller cares */
             return;
         }
-        /* give mummy-from-hero a wrapping unless hero already
-           carries one; don't bother forcing it to become worn */
-        if (mtmp->data->mlet == S_MUMMY && !carrying(MUMMY_WRAPPING))
-            (void) mongets(mtmp, MUMMY_WRAPPING);
         mtmp = christen_monst(mtmp, plname);
         newsym(u.ux, u.uy);
         /* ["Your body rises from the dead as an <mname>..." used
            to be given here, but it has been moved to done() so that
            it gets delivered even when savebones() isn't called] */
         drop_upon_death(mtmp, (struct obj *) 0, u.ux, u.uy);
+        /* 'mtmp' now has hero's inventory; if 'mtmp' is a mummy, give it
+           a wrapping unless already carrying one */
+        if (mtmp->data->mlet == S_MUMMY && !m_carrying(mtmp, MUMMY_WRAPPING))
+            (void) mongets(mtmp, MUMMY_WRAPPING);
         m_dowear(mtmp, TRUE);
     }
     if (mtmp) {