]> granicus.if.org Git - nethack/commitdiff
fix #H3134 - selling container for credit
authorPatR <rankin@nethack.org>
Sat, 12 Dec 2020 06:32:38 +0000 (22:32 -0800)
committerPatR <rankin@nethack.org>
Sat, 12 Dec 2020 06:32:38 +0000 (22:32 -0800)
If a container holds anything that a shop wouldn't ordinarily
buy and sell and you sell it for gold, the 'foreign' contents
are marked no_charge and hero still owns them.  But selling the
same container+contents for credit instead of gold would take
shop possession of all the contents without increasing the
credit amount.

The fixes entry is longer than the fix.  It solves cited case but
I won't be surprised much if it messes up some other case(s).

doc/fixes37.0
src/shk.c

index 5f7211531fecc517df8bf57f9e5f4858bcd1688c..3ad0e9471606d9f98b24d007680edb7993c6520a 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.383 $ $NHDT-Date: 1607641577 2020/12/10 23:06:17 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.386 $ $NHDT-Date: 1607754748 2020/12/12 06:32:28 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -326,6 +326,11 @@ add missing key binding support for rush.numpad; default is M-5 for numpad==1
        or plain 5 for numpad==2 where behavior of 5 and M-5 are swapped
 allow monsters to use wand of undead turning to revive corpses on floor
        in some situations
+selling a container to a shop for gold leaves any contents that the shop
+       doesn't ordinarily buy and sell owned by the hero, but selling the
+       container for credit resulted in the shop taking poesession of such
+       contents without giving any additional credit; mark out of place
+       contents 'no_charge' so that hero can reclaim them without buying
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
@@ -426,6 +431,8 @@ curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
 Qt: at Xp levels above 20 with 'showexp' On, the combined status field
        "Level:NN/nnnnnnnn" was too big and truncated by a char at each end
+Qt: searching a text window for something that wasn't found and then searching
+       for some other target could crash
 tty: redraw unexplored locations as S_unexplored rather than <space> after
        map has been partially overwritten by popup menu or text display
 tty: previous change resulted in remnants of previous level being shown on
index 64afd32078f9a8a681d25b01c83f219bfc58935c..2d1eb5b3657ff69a6482c87c37997e235776df07 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 shk.c   $NHDT-Date: 1606343581 2020/11/25 22:33:01 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.192 $ */
+/* NetHack 3.7 shk.c   $NHDT-Date: 1607754748 2020/12/12 06:32:28 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.193 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -3192,13 +3192,14 @@ xchar x, y;
             c = 'n';
 
         if (c == 'y') {
-            shk_names_obj(
-                shkp, obj,
-                (g.sell_how != SELL_NORMAL)
-                    ? "traded %s for %ld zorkmid%s in %scredit."
-                    : "relinquish %s and acquire %ld zorkmid%s in %scredit.",
-                tmpcr, (eshkp->credit > 0L) ? "additional " : "");
+            shk_names_obj(shkp, obj,
+                          ((g.sell_how != SELL_NORMAL)
+                           ? "traded %s for %ld zorkmid%s in %scredit."
+                    : "relinquish %s and acquire %ld zorkmid%s in %scredit."),
+                          tmpcr, (eshkp->credit > 0L) ? "additional " : "");
             eshkp->credit += tmpcr;
+            if (container)
+                dropped_container(obj, shkp, TRUE);
             subfrombill(obj, shkp);
         } else {
             if (c == 'q')