This is another feature the betatesters seemed to miss a lot.
the vibrating square is now a trap
mimics wouldn't take on the form of "strange object"
add an option to prevent omitting the uncursed status from inventory
+show prices when walking over the shop merchandise
Platform- and/or Interface-Specific Fixes
E boolean FDECL(the_unique_obj, (struct obj *));
E boolean FDECL(the_unique_pm, (struct permonst *));
E char *FDECL(doname, (struct obj *));
+E char *FDECL(doname_with_price, (struct obj *));
E boolean FDECL(not_fully_identified, (struct obj *));
E char *FDECL(corpse_xname, (struct obj *, const char *, unsigned));
E char *FDECL(cxname, (struct obj *));
E void FDECL(check_unpaid_usage, (struct obj *, BOOLEAN_P));
E void FDECL(check_unpaid, (struct obj *));
E void FDECL(costly_gold, (XCHAR_P, XCHAR_P, long));
+E long FDECL(get_cost_of_shop_item, (struct obj *));
E boolean FDECL(block_door, (XCHAR_P, XCHAR_P));
E boolean FDECL(block_entry, (XCHAR_P, XCHAR_P));
E char *FDECL(shk_your, (char *, struct obj *));
if (dfeature)
pline1(fbuf);
read_engr_at(u.ux, u.uy); /* Eric Backus */
- You("%s here %s.", verb, doname(otmp));
+ You("%s here %s.", verb, doname_with_price(otmp));
iflags.last_msg = PLNMSG_ONE_ITEM_HERE;
if (otmp->otyp == CORPSE)
feel_cockatrice(otmp, FALSE);
putstr(tmpwin, 0, buf);
break;
}
- putstr(tmpwin, 0, doname(otmp));
+ putstr(tmpwin, 0, doname_with_price(otmp));
}
display_nhwindow(tmpwin, TRUE);
destroy_nhwindow(tmpwin);
is_flammable(obj) ? "fireproof " : "");
}
-char *
-doname(obj)
+static char *
+doname_base(obj, with_price)
register struct obj *obj;
+boolean with_price;
{
boolean ispoisoned = FALSE;
boolean known, cknown, bknown, lknown;
Sprintf(eos(bp), " (%s, %ld %s)", obj->unpaid ? "unpaid" : "contents",
quotedprice, currency(quotedprice));
+ } else if (with_price) {
+ long price = get_cost_of_shop_item(obj);
+ if (price > 0)
+ Sprintf(eos(bp), " (%ld %s)", price, currency(price));
}
if (!strncmp(prefix, "a ", 2)
&& index(vowels, *(prefix + 2) ? *(prefix + 2) : *bp)
return (bp);
}
+char *
+doname(obj)
+register struct obj *obj;
+{
+ return doname_base(obj, FALSE);
+}
+
+/* Name of object including price. */
+char *
+doname_with_price(obj)
+register struct obj *obj;
+{
+ return doname_base(obj, TRUE);
+}
+
/* used from invent.c */
boolean
not_fully_identified(otmp)
add_menu(win, obj_to_glyph(curr), &any,
(qflags & USE_INVLET) ? curr->invlet : 0,
def_oc_syms[(int) objects[curr->otyp].oc_class].sym,
- ATR_NONE, doname(curr), MENU_UNSELECTED);
+ ATR_NONE, doname_with_price(curr), MENU_UNSELECTED);
}
}
pack++;
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)