pull request #945 - boulder vs shared shop wall

Pull request from entrez:  a boulder being sold by one shop could be
pushed into another shop if they had a shared wall with a gap in it.
Treat such as being stolen from the first shop rather than becoming
for-sale in the second shop.

[I haven't done much testing of the stolen_value() changes.]

Fixes #945
This commit is contained in:
PatR
2022-12-14 08:28:31 -08:00
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 */

View File

@@ -3036,12 +3036,18 @@ stolen_value(
boolean silent)
{
long value = 0L, gvalue = 0L, billamt = 0L;
char roomno = *in_rooms(x, y, SHOPBASE);
char roomno;
struct bill_x *bp;
struct monst *shkp = 0;
struct monst *shkp;
boolean was_unpaid;
long c_count = 0L, u_count = 0L;
if ((shkp = find_objowner(obj, x, y)) != (struct monst *) 0) {
roomno = ESHK(shkp)->shoproom;
} else {
roomno = *in_rooms(x, y, SHOPBASE);
}
/* gather information for message(s) prior to manipulating bill */
was_unpaid = obj->unpaid ? TRUE : FALSE;
if (Has_contents(obj)) {
@@ -3049,6 +3055,7 @@ stolen_value(
u_count = count_contents(obj, TRUE, FALSE, FALSE, FALSE);
}
shkp = (struct monst *) 0;
if (!billable(&shkp, obj, roomno, TRUE)) {
/* things already on the bill yield a not-billable result, so
we need to check bill before deciding that shk doesn't care */