]> granicus.if.org Git - nethack/commitdiff
bill hero for magic bag explosion
authorPatR <rankin@nethack.org>
Wed, 26 Dec 2018 00:52:33 +0000 (16:52 -0800)
committerPatR <rankin@nethack.org>
Wed, 26 Dec 2018 00:52:33 +0000 (16:52 -0800)
Exploding a bag of holding on a shop floor didn't bill for shop-owned
contents which got destroyed.  This puts them on the 'Ix' used up list.

doc/fixes36.2
src/pickup.c

index 2b164de23676c4d3205a1332659e0ad6f5992ec8..d5e938a769472cbe8b28c29b6cba744cbaf55c8a 100644 (file)
@@ -305,6 +305,8 @@ life-saving while weak/starving/fainting boosted nutrition without restoring
        lost point of strength, making temporary loss be permanent
 unlike #chat in a shop, walking on an item in a shop failed to include price
        for hero-owned container holding shop-owned items
+bag of holding explosion inside shop billed hero for unpaid contents if it
+       happened when applied while carried but not when looted while on floor
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index a8b611454527cbaa4508e96ff9426167947d0d2a..437357896ca59bec5e4a24dae6105032206b023c 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 pickup.c        $NHDT-Date: 1545597427 2018/12/23 20:37:07 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.221 $ */
+/* NetHack 3.6 pickup.c        $NHDT-Date: 1545785547 2018/12/26 00:52:27 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.222 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2201,6 +2201,19 @@ register struct obj *obj;
         if (was_unpaid)
             addtobill(obj, FALSE, FALSE, TRUE);
         obfree(obj, (struct obj *) 0);
+        /* if carried, shop goods will be flagged 'unpaid' and obfree() will
+           handle bill issues, but if on floor, we need to put them on bill
+           before deleting them (non-shop items will be flagged 'no_charge') */
+        if (floor_container
+            && costly_spot(current_container->ox, current_container->oy)) {
+            struct obj save_no_charge;
+
+            save_no_charge.no_charge = current_container->no_charge;
+            addtobill(current_container, FALSE, FALSE, FALSE);
+            /* addtobill() clears no charge; we need to set it back
+               so that useupf() doesn't double bill */
+            current_container->no_charge = save_no_charge.no_charge;
+        }
         delete_contents(current_container);
         if (!floor_container)
             useup(current_container);