From bd10bf36ecf4f75ff9106cd674b368092a83c89c Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 4 Sep 2024 03:00:57 -0700 Subject: [PATCH] address #K4246 - pushing shop boulder out of shop The report is for 3.6.7: pushing a boulder into a general store adds it to shop's inventory, but pushing it back out lets player remove it for free. 3.7 has already fixed this; update its comments though. --- src/hack.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hack.c b/src/hack.c index be77ff992..8220a3a22 100644 --- a/src/hack.c +++ b/src/hack.c @@ -482,13 +482,16 @@ moverock(void) } else { newsym(sx, sy); } - /* maybe adjust bill if boulder was pushed across shop boundary */ + /* maybe adjust bill if boulder was pushed across shop boundary; + normally otmp->unpaid would not apply because otmp isn't in hero's + inventory, but addtobill() sets it and subfrombill() clears it */ if (costly && !costly_spot(rx, ry)) { + /* pushing from inside the shop to its boundary (or free spot) */ addtobill(otmp, FALSE, FALSE, FALSE); } else if (!costly && costly_spot(rx, ry) && otmp->unpaid - && ((shkp = shop_keeper(*in_rooms(rx, ry, SHOPBASE))) - != 0) + && ((shkp = shop_keeper(*in_rooms(rx, ry, SHOPBASE))) != 0) && onshopbill(otmp, shkp, TRUE)) { + /* [can this case actually happen?] */ subfrombill(otmp, shkp); } else if (otmp->unpaid && (shkp = find_objowner(otmp, sx, sy)) != 0