]> granicus.if.org Git - nethack/commitdiff
fix "display_minventory: static object freed" panic (duplicate monster gold)
authornethack.rankin <nethack.rankin>
Thu, 21 Apr 2005 05:15:04 +0000 (05:15 +0000)
committernethack.rankin <nethack.rankin>
Thu, 21 Apr 2005 05:15:04 +0000 (05:15 +0000)
     From a bug report, using stone to flesh to
reanimate a petrified monster who was carrying gold (in his case, it was
a shopkeeper) resulted in gold in the monster's inventory.  Somehow it was
also being duplicated in the mgold field--I didn't try to figure that part
out--so killing the monster produced double gold.  More significantly,
probing such a monster prior to killing it caused a panic when the monster
inventory was being massaged for formatting.

     Fix is trivial:  use a routine which knows about special handling for
gold when transferring statue contents to resurrected monster.  Both aspects
of the problem only occurred for the !GOLDOBJ configuration (which is our
default).  However, any objects which confer something special when simply
being carried would have also been misbehaving--automagic animation of
cursed figurines is the only applicable situation; too rare for anyone to
have noticed.

doc/fixes34.4
src/trap.c

index 853f902110583cb9d6e949242abbd9e597aca2b4..898e9cedb1a6906fa04ea48e8f4099eecc597b60 100644 (file)
@@ -115,6 +115,8 @@ when blinded hero detects a trap by touch, make sure it shows up on the map
 confused remove curse will cause loss of knowledge of items' curse/bless state
 with astral vision, the ";" command should only display "normal vision"
        for things that could be seen without astral vision
+reanimating a statue containing gold produced double gold
+probing the resulting double-gold monster caused "static object freed" panic
 
 
 Platform- and/or Interface-Specific Fixes
index b20eb33cfd4239863ef53ad1967663b9dba481dd..da7a343034862af794f64a6879b709609dbea78a 100644 (file)
@@ -525,7 +525,7 @@ int *fail_reason;
        /* transfer any statue contents to monster's inventory */
        while ((item = statue->cobj) != 0) {
            obj_extract_self(item);
-           (void) add_to_minv(mon, item);
+           (void) mpickobj(mon, item);
        }
        m_dowear(mon, TRUE);
        /* in case statue is wielded and hero zaps stone-to-flesh at self */