From: Pasi Kallinen Date: Sat, 28 Jan 2023 18:01:07 +0000 (+0200) Subject: Fix shopkeeper getting mad when monster triggers a trap X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60cbab1130a2b6de11515bbe46d154addd97723b;p=nethack Fix shopkeeper getting mad when monster triggers a trap When a monster triggered a rolling boulder trap which buried a shop item in a pit, the shopkeeper would bill the hero. (Or get mad at hero, if they were out of the shop) The fix might not be quite right - should the shopkeeper get mad at hero when monster triggers a trap created by hero? Or when an item is buried in a pit created by a hero? --- diff --git a/src/dig.c b/src/dig.c index fcc1b8ec7..b5f7320b5 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1920,7 +1920,7 @@ bury_objs(int x, int y) debugpline2("bury_objs: at <%d,%d>", x, y); } for (otmp = gl.level.objects[x][y]; otmp; otmp = otmp2) { - if (costly) { + if (costly && !gc.context.mon_moving) { loss += stolen_value(otmp, x, y, (boolean) shkp->mpeaceful, TRUE); if (otmp->oclass != COIN_CLASS) otmp->no_charge = 1; diff --git a/src/invent.c b/src/invent.c index 2f21716ff..6682d75f5 100644 --- a/src/invent.c +++ b/src/invent.c @@ -4756,7 +4756,7 @@ useupf(struct obj *obj, long numused) otmp = splitobj(obj, numused); else otmp = obj; - if (costly_spot(otmp->ox, otmp->oy)) { + if (!gc.context.mon_moving && costly_spot(otmp->ox, otmp->oy)) { if (strchr(u.urooms, *in_rooms(otmp->ox, otmp->oy, 0))) addtobill(otmp, FALSE, FALSE, FALSE); else