E int FDECL(inhishop, (struct monst *));
E struct monst *FDECL(shop_keeper, (CHAR_P));
E boolean FDECL(tended_shop, (struct mkroom *));
+E boolean FDECL(is_unpaid, (struct obj *));
E void FDECL(delete_contents, (struct obj *));
E void FDECL(obfree, (struct obj *,struct obj *));
E void FDECL(home_shk, (struct monst *,BOOLEAN_P));
(toloc != MIGR_LADDER_UP && rn2(3));
container = Has_contents(otmp);
- unpaid = (otmp->unpaid || (container && count_unpaid(otmp->cobj)));
+ unpaid = is_unpaid(otmp);
if(OBJ_AT(x, y)) {
for(obj = level.objects[x][y]; obj; obj = obj->nexthere)
if (broken ||
!costly_spot(x, y) || *in_rooms(x, y, SHOPBASE) != *u.ushops) {
/* thrown out of a shop or into a different shop */
- if (count_unpaid(obj))
+ if (is_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 (count_unpaid(obj))
+ if (is_unpaid(obj))
subfrombill(obj, shkp);
else if (x != shkp->mx || y != shkp->my)
sellobj(obj, x, y);
Strcat(bp, " (alternate weapon; not wielded)");
}
if(obj->owornmask & W_QUIVER) Strcat(bp, " (in quiver)");
- if (!iflags.suppress_price && count_unpaid(obj)) {
+ if (!iflags.suppress_price && is_unpaid(obj)) {
long quotedprice = unpaid_cost(obj, TRUE);
Sprintf(eos(bp), " (%s, %ld %s)",
return (struct bill_x *)0;
}
+/* check whether an object or any of its contents belongs to a shop */
+boolean
+is_unpaid(obj)
+struct obj *obj;
+{
+ return (obj->unpaid || (Has_contents(obj) && count_unpaid(obj->cobj)));
+}
+
/* Delete the contents of the given object. */
void
delete_contents(obj)
/* get one case out of the way: nothing to sell, and no gold */
if (!isgold && ((offer + gltmp) == 0L || sell_how == SELL_DONTSELL)) {
- boolean unpaid = (obj->unpaid ||
- (container && count_unpaid(obj->cobj)));
+ boolean unpaid = is_unpaid(obj);
if(container) {
dropped_container(obj, shkp, FALSE);
if(!obj->unpaid && !saleitem)
obj->no_charge = 1;
- if(obj->unpaid || count_unpaid(obj->cobj))
+ if (unpaid)
subfrombill(obj, shkp);
} else obj->no_charge = 1;