bill hero for magic bag explosion

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.
This commit is contained in:
PatR
2018-12-25 16:52:33 -08:00
parent 5f5f7f63f1
commit 96eebc1955
2 changed files with 16 additions and 1 deletions

View 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

View 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);