more obj filtering
Add support for filtering by unpaid status for container-in and container-out actions. When taking out of a container, it works as expected if you're carrying the container while in a shop, but won't find any unpaid items if the container is on the floor. That's because they're only flagged as unpaid while in the hero's inventory. (And when it doesn't find any unpaid items it won't list 'unpaid' as a category of item to manipulate, so while that might be suboptimal for taking items out of shop containers, it shouldn't be a problem. Typically all the contents are shop-owned anyway, so using unpaid as a filter wouldn't gain any advantage over just taking stuff out.)
This commit is contained in:
@@ -1747,7 +1747,8 @@ int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P));
|
||||
nodot = (!strcmp(word, "nodot") || !strcmp(word, "drop") || ident
|
||||
|| takeoff || take_out || put_in);
|
||||
ininv = (*objchn == invent);
|
||||
bycat = (menu_class_present('B') || menu_class_present('U')
|
||||
bycat = (menu_class_present('u')
|
||||
|| menu_class_present('B') || menu_class_present('U')
|
||||
|| menu_class_present('C') || menu_class_present('X'));
|
||||
|
||||
/* someday maybe we'll sort by 'olets' too (temporarily replace
|
||||
|
||||
@@ -177,6 +177,8 @@ int *menu_on_demand;
|
||||
}
|
||||
if (itemcount && menu_on_demand)
|
||||
ilets[iletct++] = 'm';
|
||||
if (count_unpaid(objs))
|
||||
ilets[iletct++] = 'u';
|
||||
|
||||
tally_BUCX(objs, here, &bcnt, &ucnt, &ccnt, &xcnt, &ocnt);
|
||||
if (bcnt)
|
||||
@@ -222,8 +224,8 @@ int *menu_on_demand;
|
||||
goto ask_again;
|
||||
} else if (sym == 'm') {
|
||||
m_seen = TRUE;
|
||||
} else if (index("BUCX", sym)) {
|
||||
add_valid_menu_class(sym); /* 'B','U','C',or 'X' */
|
||||
} else if (index("uBUCX", sym)) {
|
||||
add_valid_menu_class(sym); /* 'u' or 'B','U','C',or 'X' */
|
||||
filtered = TRUE;
|
||||
} else {
|
||||
oc_of_sym = def_char_to_objclass(sym);
|
||||
@@ -2666,7 +2668,7 @@ boolean put_in;
|
||||
} else if (flags.menu_style == MENU_FULL) {
|
||||
all_categories = FALSE;
|
||||
Sprintf(buf, "%s what type of objects?", action);
|
||||
mflags = (ALL_TYPES | BUCX_TYPES);
|
||||
mflags = (ALL_TYPES | UNPAID_TYPES | BUCX_TYPES);
|
||||
if (put_in)
|
||||
mflags |= CHOOSE_ALL;
|
||||
n = query_category(buf, put_in ? invent : current_container->cobj,
|
||||
|
||||
Reference in New Issue
Block a user