]> granicus.if.org Git - nethack/commitdiff
Fix shopkeeper getting mad when monster triggers a trap
authorPasi Kallinen <paxed@alt.org>
Sat, 28 Jan 2023 18:01:07 +0000 (20:01 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 28 Jan 2023 18:03:23 +0000 (20:03 +0200)
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?

src/dig.c
src/invent.c

index fcc1b8ec7774d3ef6df4c726d42d58d669cd49a2..b5f7320b56562b318791a38eff1ce55f779141a5 100644 (file)
--- 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;
index 2f21716ff2f17d87460742c789969e565108cea3..6682d75f545dc84dbaacd996d7997d927556bf17 100644 (file)
@@ -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