]> granicus.if.org Git - nethack/commitdiff
Credit/debit gold in containers even in sellobj_state SELL_DONTSELL
authorTung Nguyen <tungtn3@gmail.com>
Wed, 9 Mar 2016 03:55:02 +0000 (14:55 +1100)
committerTung Nguyen <tungtn3@gmail.com>
Fri, 11 Mar 2016 07:35:26 +0000 (18:35 +1100)
There's no capacity for the shop logic to handle gold without also
changing the credit/debit within it, so gold must always be handled in
`sellobj()`, even when the state of it is set to `SELL_DONTSELL`.

This is needed for an upcoming bug fix.

Based on DynaHack commit b0784c5 (Credit/debit gold in containers even
in sellobj_state SELL_DONTSELL) by me.

src/shk.c

index 0699d36e384ab816b7f2259baa59d1449c1a1894..5d311756398c3378e45bfab93239911be87b2121 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -2880,7 +2880,8 @@ xchar x, y;
     offer = ltmp + cltmp;
 
     /* get one case out of the way: nothing to sell, and no gold */
-    if (!isgold && ((offer + gltmp) == 0L || sell_how == SELL_DONTSELL)) {
+    if (!(isgold || cgold)
+        && ((offer + gltmp) == 0L || sell_how == SELL_DONTSELL)) {
         boolean unpaid = is_unpaid(obj);
 
         if (container) {
@@ -2956,7 +2957,7 @@ xchar x, y;
                       currency(eshkp->credit));
         }
 
-        if (!offer) {
+        if (!offer || sell_how == SELL_DONTSELL) {
             if (!isgold) {
                 if (container)
                     dropped_container(obj, shkp, FALSE);