]> granicus.if.org Git - nethack/commitdiff
shop fixes
authornethack.rankin <nethack.rankin>
Tue, 31 Oct 2006 07:12:56 +0000 (07:12 +0000)
committernethack.rankin <nethack.rankin>
Tue, 31 Oct 2006 07:12:56 +0000 (07:12 +0000)
[I accidentally left this out of the previous commit.]

Throwing didn't handle a container owned by the hero which contained
items owned by the shopkeeper.  I'm still not quite sure what's going on
there, but throwing the container out of the shop didn't give any feedback
but did add to shop charges which don't show up in ``I x'' (but do get
revealed by ``$'' or ``I $'').  Now there's some shop feedback for the
throw and the contents show up for ``I x''.

src/dothrow.c

index 6ec093f98b9e515ebe92359f678c8a2cbf885d5f..5d61f0356707eb06501f261598a9a8a5f4bb9afd 100644 (file)
@@ -691,30 +691,24 @@ mhurtle(mon, dx, dy, range)
 
 STATIC_OVL void
 check_shop_obj(obj, x, y, broken)
-register struct obj *obj;
-register xchar x, y;
-register boolean broken;
+struct obj *obj;
+xchar x, y;
+boolean broken;
 {
        struct monst *shkp = shop_keeper(*u.ushops);
 
        if(!shkp) return;
 
-       if(broken) {
-               if (obj->unpaid)
-                   (void)stolen_value(obj, u.ux, u.uy,
-                                      (boolean)shkp->mpeaceful, FALSE);
-               obj->no_charge = 1;
-               return;
-       }
-
-       if (!costly_spot(x, y) || *in_rooms(x, y, SHOPBASE) != *u.ushops) {
+       if (broken ||
+           !costly_spot(x, y) || *in_rooms(x, y, SHOPBASE) != *u.ushops) {
                /* thrown out of a shop or into a different shop */
-               if (obj->unpaid)
+               if (count_unpaid(obj))
                    (void)stolen_value(obj, u.ux, u.uy,
                                       (boolean)shkp->mpeaceful, FALSE);
+               if (broken) obj->no_charge = 1;
        } else {
                if (costly_spot(u.ux, u.uy) && costly_spot(x, y)) {
-                   if (obj->unpaid)
+                   if (count_unpaid(obj))
                        subfrombill(obj, shkp);
                    else if (x != shkp->mx || y != shkp->my)
                        sellobj(obj, x, y);