]> granicus.if.org Git - nethack/commitdiff
fix "deleting worn object" impossibility
authorPatR <rankin@nethack.org>
Sun, 3 May 2015 23:54:53 +0000 (16:54 -0700)
committerPatR <rankin@nethack.org>
Sun, 3 May 2015 23:54:53 +0000 (16:54 -0700)
Migrating objects overload obj->owornmask with a destination code,
so rot_corpse needs to clear that before deleting corpses.  (Buried
objects don't touch owornmask, so rot_organic, which does the actual
object deletion, shouldn't need any similar change.)

The corpses with owornmask 3 that have been observed recently were
slated to arrive on the up stairs, so presumeably fell down the down
stairs of the current level and rotted before the hero went down.
Put plainly, it was the [post-3.4.3] impossible() check which was in
error, not the active game data.

src/dig.c

index 9f031f1c5053176b1a3fb9ddc1e46576e60e5f3c..d356668b2e4d088f0ff0313394388c5db33283c1 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -1,4 +1,4 @@
-/* NetHack 3.5 dig.c   $NHDT-Date: 1426465434 2015/03/16 00:23:54 $  $NHDT-Branch: debug $:$NHDT-Revision: 1.73 $ */
+/* NetHack 3.5 dig.c   $NHDT-Date: 1430697288 2015/05/03 23:54:48 $  $NHDT-Branch: master $:$NHDT-Revision: 1.86 $ */
 /* NetHack 3.5 dig.c   $Date: 2012/02/16 03:01:37 $  $Revision: 1.67 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1862,6 +1862,10 @@ long timeout;    /* unused */
                setmnotwielded(obj->ocarry,obj);
                MON_NOWEP(obj->ocarry);
            }
+       } else if (obj->where == OBJ_MIGRATING) {
+           /* clear destination flag so that obfree()'s check for
+              freeing a worn object doesn't get a false hit */
+           obj->owornmask = 0L;
        }
        rot_organic(arg, timeout);
        if (on_floor) {