Fix: billing shop boulder pushed thru shared wall

I realized that the "move the boulder billing to 'used-up items'" part
of 20392a6 didn't properly handle boulder movement from one shop to
another via a gap in a shared wall, becuase it wasn't looking at the
complete in_rooms() array (plus, it only triggered if the new spot
wasn't in any shops at all).  When I tried to fix that, I realized that
stolen_value() was similarly not working reliably when passed a location
shared between two shops, and for the same reason: it was only using the
first character of the in_rooms() array.

I think this patch fixes both those things, but it would be worth
examining the change to stolen_value() carefully, to ensure getting the
roomno via the shkp won't change anything about its normal functioning.
I'm not totally sure about that -- I didn't notice any problems in some
brief tests of typical stolen_value() uses, but it seems like it
probably has some tricky edge cases.

At the very least, passing a boulder fully through a shared wall between
two shops one way, then back the other way, no longer triggers an unpaid
obj sanity check in my testing.
This commit is contained in:
Michael Meyer
2022-12-06 20:52:13 -05:00
committed by PatR
parent daeec9291c
commit 05117fa84f
2 changed files with 13 additions and 4 deletions

View File

@@ -462,8 +462,10 @@ moverock(void)
!= 0)
&& onshopbill(otmp, shkp, TRUE)) {
subfrombill(otmp, shkp);
} else if (otmp->unpaid && !*in_rooms(rx, ry, SHOPBASE)
&& *in_rooms(sx, sy, SHOPBASE)) {
} else if (otmp->unpaid
&& (shkp = find_objowner(otmp, sx, sy)) != 0
&& !strchr(in_rooms(rx, ry, SHOPBASE),
ESHK(shkp)->shoproom)) {
/* once the boulder is fully out of the shop, so that it's
* impossible to change your mind and push it back in without
* leaving and triggering Kops, switch it to stolen_value */