]> granicus.if.org Git - nethack/commitdiff
shop object sanity - buried objects
authorPatR <rankin@nethack.org>
Fri, 27 Jan 2023 19:01:24 +0000 (11:01 -0800)
committerPatR <rankin@nethack.org>
Fri, 27 Jan 2023 19:01:24 +0000 (11:01 -0800)
This fixes the reported sanity check warning about a buried object
within shop boundary staying flagged no_charge after the shopkeeper
leaves the shop.  Leaving the shop to pursue the hero moves unpaid
items off the bill to owed-as-robbery and changes no_charge items
to shop-owned but it wasn't doing the latter for buried objects.

I haven't attempted to test on a level with multiple shopkeepers.
If that was working correctly for unpaid items than I think it
ought to work correctly for no_charge items now.  I'm not sure how
thoroughly the handling for unpaid items was tested though.

src/shk.c

index 535a9d872c8926bc8c26ebbfa555670bae07c7fc..1e7725938f6382910e658475528bb635ff724e19 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -307,7 +307,9 @@ clear_no_charge_obj(
          * returns.
          */
         if (!shkp
-            || (otmp->where != OBJ_FLOOR && otmp->where != OBJ_CONTAINED)
+            || (otmp->where != OBJ_FLOOR
+                && otmp->where != OBJ_CONTAINED
+                && otmp->where != OBJ_BURIED)
             || !get_obj_location(otmp, &x, &y, OBJ_CONTAINED | OBJ_BURIED)
             || !isok(x, y)
             || (rno = levl[x][y].roomno) < ROOMOFFSET
@@ -354,6 +356,7 @@ setpaid(register struct monst *shkp)
 
     /* clear obj->no_charge for all obj in shkp's shop */
     clear_no_charge(shkp, fobj);
+    clear_no_charge(shkp, gl.level.buriedobjlist);
 
     while ((obj = gb.billobjs) != 0) {
         obj_extract_self(obj);