From 5d42ebb6f1ebaacb83ac6f5e0a44d412b0e238ab Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 5 Nov 2006 04:16:10 +0000 Subject: [PATCH] clearing no_charge bit for containers [I can't get access to my mail at present, but `cvs update' shows that there aren't any patch notification messages pending for me.] Extend a pre-3.4.3 fix--for objects picked up in an untended shop-- to container contents. Without it, dropping a bag or box in a tended shop and declining to sell it, then picking it back up after the shop has become untended (shk killed or evicted) would leave the contents with no_charge set. After that it could be sold in another tended shop, picked back up for free, then kept or sold a second time. (Picking it back up in the tended shop would clear the bit; afterwards it behaved normally. And it's not something prone to abuse; if you can make a tended shop become untended you really don't need to sell stuff twice. But it'd be noticeably wrong if anyone ever stumbled across it.) --- doc/fixes34.4 | 2 ++ src/invent.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 61db532bd..8486a92d2 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -107,6 +107,8 @@ fix various places that "finally finished" could be displayed after the hero fix some cases where movement was disallowed but the hero was still conscious after destroying drawbridge, hero could appear to be in the wall sometimes shop items which hero is forced to buy could be sold back twice +non-empty container dropped but not sold in a tended shop and then picked up + after that shop became untended could be sold twice in another shop vision was not updated when polymorphing a statue into a boulder `I u' when carrying single unpaid item listed its cost twice armor which auto-curses when worn by hero should do same if worn by monster diff --git a/src/invent.c b/src/invent.c index 0f2ac6059..7692bcfae 100644 --- a/src/invent.c +++ b/src/invent.c @@ -299,8 +299,11 @@ struct obj *obj; if (obj->where != OBJ_FREE) panic("addinv: obj not free"); - obj->no_charge = 0; /* not meaningful for invent */ - obj->was_thrown = 0; /* ditto */ + /* normally addtobill() clears no_charge when items in a shop are + picked up, but won't do so if the shop has become untended */ + obj->no_charge = 0; /* should not be set in hero's invent */ + if (Has_contents(obj)) picked_container(obj); /* clear no_charge */ + obj->was_thrown = 0; /* not meaningful for invent */ addinv_core1(obj); #ifndef GOLDOBJ -- 2.40.0