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.
This commit is contained in:
Pasi Kallinen
2025-01-08 12:49:15 +02:00
parent 9b71efe69e
commit 256b820fe3
2 changed files with 16 additions and 15 deletions

View File

@@ -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

View File

@@ -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;