char *op;
{
int oc_sym, num;
- char *sp, buf[BUFSZ];
+ char *sp, buf[QBUFSZ];
num = 0;
- /* !!!! probably unnecessary with gold as normal inventory */
+ if (!index(op, GOLD_SYM))
+ buf[num++] = COIN_CLASS;
for (sp = op; *sp; sp++) {
oc_sym = def_char_to_objclass(*sp);
/* reject bad or duplicate entries */
- if (oc_sym == MAXOCLASSES || oc_sym == RANDOM_CLASS
- || oc_sym == ILLOBJ_CLASS || !index(flags.inv_order, oc_sym)
- || index(sp + 1, *sp))
+ if (oc_sym == MAXOCLASSES /* not an object class char */
+ /* VENOM_CLASS, RANDOM_CLASS, and ILLOBJ_CLASS are excluded
+ because they aren't in def_inv_order[] so don't make it
+ into flags.inv_order, hence always fail this index() test */
+ || !index(flags.inv_order, oc_sym) || index(sp + 1, *sp))
return 0;
/* retain good ones */
buf[num++] = (char) oc_sym;
/* fill in any omitted classes, using previous ordering */
for (sp = flags.inv_order; *sp; sp++)
- if (!index(buf, *sp)) {
- buf[num++] = *sp;
- buf[num] = '\0'; /* explicitly terminate for next index() */
- }
+ if (!index(buf, *sp))
+ (void) strkitten(&buf[num++], *sp);
+ buf[MAXOCLASSES - 1] = '\0';
Strcpy(flags.inv_order, buf);
return 1;
struct obj *curr, *last, fake_hero_object, *olist = *olist_p;
char *pack;
anything any;
- boolean printed_type_name,
+ boolean printed_type_name, first,
sorted = (qflags & INVORDER_SORT) != 0,
engulfer = (qflags & INCLUDE_HERO) != 0;
* be called once per object in the list.
*/
pack = flags.inv_order;
+ first = TRUE;
do {
printed_type_name = FALSE;
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
any.a_obj = curr;
add_menu(win, obj_to_glyph(curr), &any,
- (qflags & USE_INVLET) ? curr->invlet : 0,
+ (qflags & USE_INVLET) ? curr->invlet
+ : (first && curr->oclass == COIN_CLASS) ? '$' : 0,
def_oc_syms[(int) objects[curr->otyp].oc_class].sym,
ATR_NONE, doname_with_price(curr), MENU_UNSELECTED);
+ first = FALSE;
}
}
pack++;
} else if (flags.menu_style == MENU_FULL) {
all_categories = FALSE;
Sprintf(buf, "%s what type of objects?", action);
- mflags = put_in
- ? ALL_TYPES | BUC_ALLBKNOWN | BUC_UNKNOWN
- : ALL_TYPES | CHOOSE_ALL | BUC_ALLBKNOWN | BUC_UNKNOWN;
+ mflags = (ALL_TYPES | BUC_ALLBKNOWN | BUC_UNKNOWN);
+ if (put_in)
+ mflags |= CHOOSE_ALL;
n = query_category(buf, put_in ? invent : current_container->cobj,
mflags, &pick_list, PICK_ANY);
if (!n)