looting gold
When removing items from a container via menu, list gold as '$'
instead of 'a' when it is the first item. Requested during beta
testing last year....
When gold isn't first ('sortpack' false, or custom 'inv_order[]'),
it uses the next letter in sequence instead of '$', otherwise it
would be the only item out of sequence.
This commit is contained in:
@@ -1010,17 +1010,20 @@ change_inv_order(op)
|
||||
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;
|
||||
@@ -1029,10 +1032,9 @@ char *op;
|
||||
|
||||
/* 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;
|
||||
|
||||
13
src/pickup.c
13
src/pickup.c
@@ -791,7 +791,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
|
||||
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;
|
||||
|
||||
@@ -843,6 +843,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
|
||||
* 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)) {
|
||||
@@ -868,9 +869,11 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
|
||||
|
||||
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++;
|
||||
@@ -2586,9 +2589,9 @@ boolean put_in;
|
||||
} 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)
|
||||
|
||||
Reference in New Issue
Block a user