From: nethack.rankin Date: Wed, 15 May 2002 23:15:39 +0000 (+0000) Subject: #loot in shop X-Git-Tag: MOVE2GIT~2742 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c07c88dac8c7e59387862f7968a922181266da3;p=nethack #loot in shop Fix the reported bug of being double-billed for a bag of holding destroyed if #loot is used to put a wand of cancellation into it while it's on a shop floor. (The bug report neglected to mention a second aspect of the situation: you wouldn't get billed for the wand if you used an unpaid one to trigger this.) --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index ebf4b1a58..cf27d2da9 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -104,6 +104,7 @@ suppress redundant message when stoning effect transforms a golem clear worn bits of any object grabbed by shopkeeper to avoid extract_nobj panic looting any container on a location should suppress looting nearby monsters give more specific message when forbidden role attempts to use twoweapon mode +avoid double billing if #loot causes a shop's bag of holding to explode Platform- and/or Interface-Specific Fixes diff --git a/src/pickup.c b/src/pickup.c index b62d1c85d..4d6c6b614 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)pickup.c 3.4 2002/04/07 */ +/* SCCS Id: @(#)pickup.c 3.4 2002/05/15 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1671,6 +1671,7 @@ in_container(obj) register struct obj *obj; { boolean floor_container = !carried(current_container); + boolean was_unpaid = FALSE; char buf[BUFSZ]; if (!current_container) { @@ -1755,9 +1756,16 @@ register struct obj *obj; (void) snuff_lit(obj); if (floor_container && costly_spot(u.ux, u.uy)) { + if (current_container->no_charge && !obj->unpaid) { + /* don't sell when putting the item into your own container */ + obj->no_charge = 1; + } else { + /* sellobj() will take an unpaid item off the shop bill */ + was_unpaid = obj->unpaid ? TRUE : FALSE; sellobj_state(SELL_DELIBERATE); sellobj(obj, u.ux, u.uy); sellobj_state(SELL_NORMAL); + } } if (Icebox && obj->otyp != OIL_LAMP && obj->otyp != BRASS_LANTERN && !Is_candle(obj)) { @@ -1768,21 +1776,11 @@ register struct obj *obj; (void) stop_timer(REVIVE_MON, (genericptr_t)obj); /* mark a non-reviving corpse as such */ if (rot_alarm) obj->norevive = 1; - } - } - - else if (Is_mbag(current_container) && mbag_explodes(obj, 0)) { - You("are blasted by a magical explosion!"); - - /* the !floor_container case is taken care of */ - if(*u.ushops && costly_spot(u.ux, u.uy) && floor_container) { - register struct monst *shkp; - - if ((shkp = shop_keeper(*u.ushops)) != 0) - (void)stolen_value(current_container, u.ux, u.uy, - (boolean)shkp->mpeaceful, FALSE); } + } else if (Is_mbag(current_container) && mbag_explodes(obj, 0)) { + You("are blasted by a magical explosion!"); /* did not actually insert obj yet */ + if (was_unpaid) addtobill(obj, FALSE, FALSE, TRUE); obfree(obj, (struct obj *)0); delete_contents(current_container); if (!floor_container)