Show cost of merchandise when walking over it
This is another feature the betatesters seemed to miss a lot.
This commit is contained in:
@@ -1865,6 +1865,36 @@ unsigned id;
|
||||
return (struct obj *) 0;
|
||||
}
|
||||
|
||||
/* Returns the price of an arbitrary item in the shop.
|
||||
* Returns 0 if the item doesn't belong to a shopkeeper. */
|
||||
long
|
||||
get_cost_of_shop_item(obj)
|
||||
register struct obj *obj;
|
||||
{
|
||||
struct monst *shkp;
|
||||
xchar x, y;
|
||||
int cost=0;
|
||||
|
||||
if (get_obj_location(obj, &x, &y, 0) &&
|
||||
(obj->unpaid ||
|
||||
(obj->where == OBJ_FLOOR && !obj->no_charge && costly_spot(x,y)))) {
|
||||
|
||||
if (!(shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)))) return 0;
|
||||
if (!inhishop(shkp)) return 0;
|
||||
if (!costly_spot(x, y)) return 0;
|
||||
if (!*u.ushops) return 0;
|
||||
|
||||
if (obj->oclass != COIN_CLASS) {
|
||||
cost = (obj == uball || obj == uchain) ? 0L :
|
||||
obj->quan * get_cost(obj, shkp);
|
||||
if (Has_contents(obj)) {
|
||||
cost += contained_cost(obj, shkp, 0L, FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
/* calculate the value that the shk will charge for [one of] an object */
|
||||
STATIC_OVL long
|
||||
get_cost(obj, shkp)
|
||||
|
||||
Reference in New Issue
Block a user