fix #K3016 - kicking a bag of gold in a shop

Kicking a container that had gold in it took the gold amount
away from hero's credit or added to hero's debt, then didn't
give a refund if the container and its gold landed within the
shop.  Throwing behaved likewise, just less verbosely.

The problem is caused by addtobill() treating gold specially
and then subfrombill() not being able to perform a reverse
operation.  Actually, it may be possible for subfrombill() to
do that, but verifying all its uses is too much work.  This
moves the gold handling for drop+selling into its own routine
and adds calls to that for the throwing and kicking refunds.
The other calls to subfrombill() outside of shk.c appear to be
ok as-is.  (The calls inside that file are the ones that still
need evaluation if the gold handling is to move to there.)

bill_dummy_object() now uses the same o_id assignment for its
dummy object as split_object() does for its new partial stack.
I don't know whether the old code led to any price glitches.
This commit is contained in:
PatR
2020-11-25 14:33:14 -08:00
parent 6df9ebc1af
commit 2db51cf8bd
6 changed files with 81 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.362 $ $NHDT-Date: 1606243387 2020/11/24 18:43:07 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.363 $ $NHDT-Date: 1606343573 2020/11/25 22:32:53 $
General Fixes and Modified Features
-----------------------------------
@@ -308,6 +308,9 @@ wand/scroll of create monster or bag of tricks that makes a new monster which
wizard mode (only way to get timed flying): if levitation and flying time out
on same turn, player was told "You have stopped levitating and are
now flying."; status line wasn't updated to remove stale Fly condition
throwing or kicking a shop container (that's light enough to move) made the
hero pay for any gold inside, then didn't refund that amount if the
container landed inside the shop
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository