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.)
This commit is contained in:
nethack.rankin
2006-11-05 04:16:10 +00:00
parent bc9f91fce5
commit 5d42ebb6f1
2 changed files with 7 additions and 2 deletions

View File

@@ -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

View File

@@ -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