MCPcopy Create free account
hub / github.com/crawl/crawl / select_items

Function select_items

crawl-ref/source/invent.cc:1219–1253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1217}
1218
1219vector<SelItem> select_items(const vector<const item_def*> &items,
1220 const char *title, bool noselect,
1221 menu_type mtype)
1222{
1223 vector<SelItem> selected;
1224 if (!items.empty())
1225 {
1226 InvMenu menu;
1227 menu.set_type(mtype);
1228 menu.set_title(title);
1229 if (mtype == menu_type::pickup)
1230 menu.set_tag("pickup");
1231
1232 menu.load_items(items);
1233 int new_flags = noselect ? MF_NOSELECT
1234 : MF_MULTISELECT | MF_ALLOW_FILTER;
1235
1236 if (mtype == menu_type::sel_one)
1237 {
1238 new_flags |= MF_SINGLESELECT;
1239 new_flags &= ~MF_MULTISELECT;
1240 }
1241
1242 if (!!(new_flags & MF_MULTISELECT))
1243 new_flags |= MF_SELECT_QTY;
1244
1245 new_flags |= MF_ALLOW_FORMATTING | MF_ARROWS_SELECT;
1246 if (!Options.single_column_item_menus)
1247 new_flags |= menu.get_flags() & MF_USE_TWO_COLUMNS;
1248 menu.set_flags(new_flags);
1249 menu.show();
1250 selected = menu.get_selitems(true);
1251 }
1252 return selected;
1253}
1254
1255bool item_is_selected(const item_def &i, int selector)
1256{

Callers 2

process_keyMethod · 0.85
pickup_menuFunction · 0.85

Calls 9

set_typeMethod · 0.80
load_itemsMethod · 0.80
get_selitemsMethod · 0.80
emptyMethod · 0.45
set_titleMethod · 0.45
set_tagMethod · 0.45
get_flagsMethod · 0.45
set_flagsMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected