the #inventtype command */
| 3824 | |
| 3825 | /* the #inventtype command */ |
| 3826 | int |
| 3827 | dotypeinv(void) |
| 3828 | { |
| 3829 | static const char |
| 3830 | prompt[] = "What type of object do you want an inventory of?"; |
| 3831 | char c = '\0'; |
| 3832 | int n, i = 0; |
| 3833 | char *extra_types, types[BUFSZ], title[QBUFSZ]; |
| 3834 | const char *before = "", *after = ""; |
| 3835 | int class_count, oclass, itemcount, |
| 3836 | any_unpaid, u_carried, u_floor, u_buried; |
| 3837 | int bcnt, ccnt, ucnt, xcnt, ocnt, jcnt; |
| 3838 | boolean billx = *u.ushops && doinvbill(0); |
| 3839 | menu_item *pick_list; |
| 3840 | boolean traditional = TRUE; |
| 3841 | |
| 3842 | gt.this_type = 0; |
| 3843 | gt.this_title = NULL; |
| 3844 | if (!gi.invent && !billx) { |
| 3845 | You("aren't carrying anything."); |
| 3846 | goto doI_done; |
| 3847 | } |
| 3848 | title[0] = '\0'; |
| 3849 | u_carried = count_unpaid(gi.invent); |
| 3850 | u_floor = count_unpaid(fobj); |
| 3851 | u_buried = count_unpaid(svl.level.buriedobjlist); |
| 3852 | any_unpaid = u_carried + u_floor + u_buried; |
| 3853 | tally_BUCX(gi.invent, FALSE, &bcnt, &ucnt, &ccnt, &xcnt, &ocnt, &jcnt); |
| 3854 | |
| 3855 | if (flags.menu_style != MENU_TRADITIONAL) { |
| 3856 | if (flags.menu_style == MENU_FULL |
| 3857 | || flags.menu_style == MENU_PARTIAL) { |
| 3858 | traditional = FALSE; |
| 3859 | i = UNPAID_TYPES; |
| 3860 | if (billx) |
| 3861 | i |= BILLED_TYPES; |
| 3862 | if (bcnt) |
| 3863 | i |= BUC_BLESSED; |
| 3864 | if (ucnt) |
| 3865 | i |= BUC_UNCURSED; |
| 3866 | if (ccnt) |
| 3867 | i |= BUC_CURSED; |
| 3868 | if (xcnt) |
| 3869 | i |= BUC_UNKNOWN; |
| 3870 | if (jcnt) |
| 3871 | i |= JUSTPICKED; |
| 3872 | i |= INCLUDE_VENOM; |
| 3873 | n = query_category(prompt, gi.invent, i, &pick_list, PICK_ONE); |
| 3874 | if (!n) |
| 3875 | goto doI_done; |
| 3876 | gt.this_type = c = pick_list[0].item.a_int; |
| 3877 | free((genericptr_t) pick_list); |
| 3878 | } |
| 3879 | } |
| 3880 | if (traditional) { |
| 3881 | /* collect list of classes of objects carried, for use as a prompt */ |
| 3882 | types[0] = 0; |
| 3883 | class_count = collect_obj_classes(types, gi.invent, FALSE, |
nothing calls this directly
no test coverage detected