* For menustyle:Full. * * allow menu-based category (class) selection (for Drop,take off etc.) * * If ParanoidAutoAll, requires confirmation when 'A' has been picked. */
| 1223 | * If ParanoidAutoAll, requires confirmation when 'A' has been picked. |
| 1224 | */ |
| 1225 | int |
| 1226 | query_category( |
| 1227 | const char *qstr, /* query string */ |
| 1228 | struct obj *olist, /* the list to pick from */ |
| 1229 | int qflags, /* behavior modification flags */ |
| 1230 | menu_item **pick_list, /* return list of items picked */ |
| 1231 | int how) /* type of query */ |
| 1232 | { |
| 1233 | int n; |
| 1234 | winid win; |
| 1235 | struct obj *curr; |
| 1236 | char *pack, packbuf[MAXOCLASSES + 1]; |
| 1237 | anything any; |
| 1238 | boolean collected_type_name; |
| 1239 | char invlet; |
| 1240 | int ccount; |
| 1241 | boolean (*ofilter)(OBJ_P) = (boolean (*)(OBJ_P)) 0; |
| 1242 | boolean show_a, |
| 1243 | do_unpaid = FALSE, do_usedup = FALSE, |
| 1244 | do_blessed = FALSE, do_cursed = FALSE, |
| 1245 | do_uncursed = FALSE, do_buc_unknown = FALSE, |
| 1246 | do_worn = FALSE, verify_All = FALSE; |
| 1247 | int num_buc_types = 0, num_justpicked = 0, clr = NO_COLOR; |
| 1248 | |
| 1249 | *pick_list = (menu_item *) 0; |
| 1250 | if (!olist) |
| 1251 | return 0; |
| 1252 | if ((qflags & UNPAID_TYPES) != 0 && count_unpaid(olist)) |
| 1253 | do_unpaid = TRUE; |
| 1254 | /* caller only passes BILLED_TYPES when there are some used up items |
| 1255 | on shop's bill */ |
| 1256 | if ((qflags & BILLED_TYPES) != 0) |
| 1257 | do_usedup = TRUE; |
| 1258 | /* for the 'A' command to remove worn/wielded */ |
| 1259 | if ((qflags & WORN_TYPES) != 0) { |
| 1260 | do_worn = TRUE; |
| 1261 | ofilter = is_worn; |
| 1262 | } |
| 1263 | if ((qflags & BUC_BLESSED) != 0 |
| 1264 | && count_buc(olist, BUC_BLESSED, ofilter)) { |
| 1265 | do_blessed = TRUE; |
| 1266 | num_buc_types++; |
| 1267 | } |
| 1268 | if ((qflags & BUC_CURSED) != 0 |
| 1269 | && count_buc(olist, BUC_CURSED, ofilter)) { |
| 1270 | do_cursed = TRUE; |
| 1271 | num_buc_types++; |
| 1272 | } |
| 1273 | if ((qflags & BUC_UNCURSED) != 0 |
| 1274 | && count_buc(olist, BUC_UNCURSED, ofilter)) { |
| 1275 | do_uncursed = TRUE; |
| 1276 | num_buc_types++; |
| 1277 | } |
| 1278 | if ((qflags & BUC_UNKNOWN) != 0 |
| 1279 | && count_buc(olist, BUC_UNKNOWN, ofilter)) { |
| 1280 | do_buc_unknown = TRUE; |
| 1281 | num_buc_types++; |
| 1282 | } |
no test coverage detected