#tipping shop containers (trunk only)

Using #tip (post-3.4.3 code) on a container that's on a shop floor
didn't handle ownership correctly.  Bag of tricks could be emptied for
free, and contents of other containers were being sold to the shop even
when the shop already owned them.  This fixes bag of tricks and makes a
first cut at doing so for regular containers.

     Message handling when #tipping any bag of tricks was also suboptimal
since the decision about message delivery was made again as each charge
released something instead of waiting until the whole bag was emptied.
So you could get inappropriate "nothing seems to happen" before or after
a monster visibily popped up if something unseen was also produced.
This commit is contained in:
nethack.rankin
2006-11-09 06:36:36 +00:00
parent ef2085bcaf
commit f8f5642d3a
5 changed files with 47 additions and 18 deletions

View File

@@ -1828,8 +1828,7 @@ boolean tipping; /* caller emptying entire contents; affects shop handling */
obj->owt = weight(obj);
/* using a shop's horn of plenty entails a usage fee and also
confers ownership of the created item to the shopkeeper */
if (carried(horn) ? horn->unpaid :
(costly_spot(u.ux, u.uy) && !horn->no_charge))
if (horn->unpaid)
addtobill(obj, FALSE, FALSE, tipping);
/* if it ended up on bill, we don't want "(unpaid, N zorkids)"
being included in its formatted name during next message */