From 256b820fe34299048304e08f01369e3fcb33caba Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 8 Jan 2025 12:49:15 +0200 Subject: [PATCH] Fix impossible no_charge obj in untended shop Sanity checking was complaining about a no_charge obj in untended shop. Angry shopkeeper was accepting thrown items as no_charge objects: To reproduce the impossible, kick down the shop door angering the shopkeeper. While the shopkeeper is still in their shop, throw an item they don't want into the shop. Wait for the shopkeeper to get out of the shop. Move the anger checking before the sell auto-accept code, so the shopkeeper will charge for the object. --- doc/fixes3-7-0.txt | 1 + src/shk.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 4e4b02a2c..4d9b7173a 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1498,6 +1498,7 @@ remember box is trapped after finding the trap when you hear a monster incant a scroll, ensure that the 'I' invisible monster indicator doesn't trump telepathy briefly proceed with showpaths option even if the sysconf file is missing +angry shopkeeper was not charging for thrown items Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/shk.c b/src/shk.c index 103ca22da..315b4002d 100644 --- a/src/shk.c +++ b/src/shk.c @@ -3886,6 +3886,21 @@ sellobj( offer = ltmp + cltmp; + /* you dropped something of your own - probably want to sell it */ + rouse_shk(shkp, TRUE); /* wake up sleeping or paralyzed shk */ + eshkp = ESHK(shkp); + + if (ANGRY(shkp)) { /* they become shop-objects, no pay */ + if (!Deaf && !muteshk(shkp)) { + SetVoice(shkp, 0, 80, 0); + verbalize("Thank you, scum!"); + } else { + pline("%s smirks with satisfaction.", Shknam(shkp)); + } + subfrombill(obj, shkp); + return; + } + /* get one case out of the way: nothing to sell, and no gold */ if (!(isgold || cgold) && ((offer + gltmp) == 0L || gs.sell_how == SELL_DONTSELL)) { @@ -3906,21 +3921,6 @@ sellobj( return; } - /* you dropped something of your own - probably want to sell it */ - rouse_shk(shkp, TRUE); /* wake up sleeping or paralyzed shk */ - eshkp = ESHK(shkp); - - if (ANGRY(shkp)) { /* they become shop-objects, no pay */ - if (!Deaf && !muteshk(shkp)) { - SetVoice(shkp, 0, 80, 0); - verbalize("Thank you, scum!"); - } else { - pline("%s smirks with satisfaction.", Shknam(shkp)); - } - subfrombill(obj, shkp); - return; - } - if (eshkp->robbed) { /* bones; shop robbed by previous customer */ if (isgold) offer = obj->quan;