From: PatR Date: Sat, 12 Dec 2020 06:32:38 +0000 (-0800) Subject: fix #H3134 - selling container for credit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d65d6dbf013525355486141aaa51519d1069549;p=nethack fix #H3134 - selling container for credit 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). --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 5f7211531..3ad0e9471 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 after map has been partially overwritten by popup menu or text display tty: previous change resulted in remnants of previous level being shown on diff --git a/src/shk.c b/src/shk.c index 64afd3207..2d1eb5b36 100644 --- 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')