extern int inhishop(struct monst *);
extern struct monst *shop_keeper(char);
extern boolean tended_shop(struct mkroom *);
+struct bill_x *onbill(struct obj *, struct monst *, boolean);
extern boolean is_unpaid(struct obj *);
extern void delete_contents(struct obj *);
extern void obfree(struct obj *, struct obj *);
register coordxy rx, ry, sx, sy;
struct obj *otmp;
struct trap *ttmp;
- struct monst *mtmp;
+ struct monst *mtmp, *shkp;
const char *what;
- boolean firstboulder = TRUE;
+ boolean costly, firstboulder = TRUE;
int res = 0;
sx = u.ux + u.dx, sy = u.uy + u.dy; /* boulder starting position */
|| doorless_door(rx, ry)) && !sobj_at(BOULDER, rx, ry)) {
ttmp = t_at(rx, ry);
mtmp = m_at(rx, ry);
+ costly = (!otmp->no_charge && costly_spot(sx, sy)
+ && shop_keeper(*in_rooms(sx, sy, SHOPBASE)));
/* KMH -- Sokoban doesn't let you push boulders diagonally */
if (Sokoban && u.dx && u.dy) {
(ttmp->ttyp == TRAPDOOR) ? "trap door" : "hole",
surface(rx, ry));
deltrap(ttmp);
- delobj(otmp);
+ useupf(otmp, 1L);
bury_objs(rx, ry);
levl[rx][ry].wall_info &= ~W_NONDIGGABLE;
levl[rx][ry].candig = 1;
if (ttmp->ttyp == TELEP_TRAP) {
(void) rloco(otmp);
} else {
+ if (costly)
+ addtobill(otmp, FALSE, FALSE, FALSE);
obj_extract_self(otmp);
add_to_migration(otmp);
get_level(&dest, newlev);
} else {
newsym(sx, sy);
}
+ /* maybe adjust bill if boulder was pushed across shop boundary */
+ if (costly && !costly_spot(rx, ry)) {
+ addtobill(otmp, FALSE, FALSE, FALSE);
+ } else if (!costly && costly_spot(rx, ry) && otmp->unpaid
+ && (shkp = shop_keeper(*in_rooms(rx, ry, SHOPBASE)))
+ && onbill(otmp, shkp, TRUE)) {
+ subfrombill(otmp, shkp);
+ }
} else {
nopushmsg:
what = the(xname(otmp));
static void append_honorific(char *);
static long addupbill(struct monst *);
static void pacify_shk(struct monst *, boolean);
-static struct bill_x *onbill(struct obj *, struct monst *, boolean);
static struct monst *next_shkp(struct monst *, boolean);
static long shop_debt(struct eshk *);
static char *shk_owns(char *, struct obj *);
return !mtmp ? FALSE : (boolean) inhishop(mtmp);
}
-static struct bill_x *
-onbill(struct obj* obj, struct monst* shkp, boolean silent)
+struct bill_x *
+onbill(struct obj *obj, struct monst *shkp, boolean silent)
{
if (shkp) {
register struct bill_x *bp = ESHK(shkp)->bill_p;