shop sanity check of the day...

If a pet picks up a no_charge item in a shop and gets teleported out,
clear that flag.  (It's already being cleared for non-pets as soon as
they pick any item up.)
This commit is contained in:
PatR
2022-12-09 12:55:39 -08:00
parent 9fa08b383f
commit 7c0c0ba66a

View File

@@ -1286,7 +1286,7 @@ rloc_pos_ok(
*/
static void
rloc_to_core(
struct monst* mtmp,
struct monst *mtmp,
coordxy x, coordxy y,
unsigned rlocflags)
{
@@ -1371,6 +1371,25 @@ rloc_to_core(
if (resident_shk && !inhishop(mtmp))
make_angry_shk(mtmp, oldx, oldy);
/* if a monster carrying shop goods teleports out of the shop, blame
it on the hero; chance of an unpaid item is vanishingly small, but
no_charge is easily possible and needs to be cleared if not in shop;
a for-sale item is ordinary here--shk won't notice it leaving; if
mtmp teleports from one shop into another, no_charge status sticks
and an item on the first shk's bill stays there */
if (mtmp->minvent && !costly_spot(x, y)) {
struct obj *otmp;
struct monst *shkp = find_objowner(mtmp->minvent, oldx, oldy);
boolean peaceful = !shkp || shkp->mpeaceful;
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
if (otmp->no_charge)
otmp->no_charge = 0;
else if (shkp && onshopbill(otmp, shkp, TRUE))
stolen_value(otmp, oldx, oldy, peaceful, FALSE);
}
}
/* if hero is busy, maybe stop occupation */
if (go.occupation)
(void) dochugw(mtmp, FALSE);