the #knownclass command - show discovered object types for one class; in addition to actual object classes, supports pseudo-class 'a' for discovered artifacts and 'u' (or 'r', for "relics") for unique items */
| 888 | in addition to actual object classes, supports pseudo-class 'a' for |
| 889 | discovered artifacts and 'u' (or 'r', for "relics") for unique items */ |
| 890 | int |
| 891 | doclassdisco(void) |
| 892 | { |
| 893 | static NEARDATA const char |
| 894 | prompt[] = "View discoveries for which sort of objects?", |
| 895 | havent_discovered_any[] = "haven't discovered any %s yet.", |
| 896 | unique_items[] = "unique items or relics", |
| 897 | artifact_items[] = "artifacts"; |
| 898 | winid tmpwin = WIN_ERR; |
| 899 | menu_item *pick_list = 0; |
| 900 | anything any; |
| 901 | char *s, c, oclass, menulet, allclasses[MAXOCLASSES], |
| 902 | discosyms[3 + MAXOCLASSES + 1], buf[BUFSZ], |
| 903 | *sorted_lines[NUM_OBJECTS]; /* overkill */ |
| 904 | const char *p; |
| 905 | int i, ct, dis, xtras, sorted_ct, uidx; |
| 906 | boolean traditional, alphabetized, lootsort; |
| 907 | int clr = NO_COLOR; |
| 908 | |
| 909 | if (!flags.discosort || !(p = strchr(disco_order_let, flags.discosort))) |
| 910 | flags.discosort = 'o'; |
| 911 | |
| 912 | if (iflags.menu_requested) { |
| 913 | if (choose_disco_sort(2) < 0) |
| 914 | return ECMD_OK; |
| 915 | } |
| 916 | alphabetized = (flags.discosort == 'a' || flags.discosort == 'c'); |
| 917 | lootsort = (flags.discosort == 's'); |
| 918 | |
| 919 | discosyms[0] = '\0'; |
| 920 | traditional = (flags.menu_style == MENU_TRADITIONAL |
| 921 | || flags.menu_style == MENU_COMBINATION); |
| 922 | if (!traditional) { |
| 923 | tmpwin = create_nhwindow(NHW_MENU); |
| 924 | start_menu(tmpwin, MENU_BEHAVE_STANDARD); |
| 925 | } |
| 926 | any = cg.zeroany; |
| 927 | menulet = 'a'; |
| 928 | |
| 929 | /* |
| 930 | * FIXME? |
| 931 | * relics and artifacts don't obey player's sort order even though |
| 932 | * the header line states that they're shown in such-and-such order. |
| 933 | */ |
| 934 | |
| 935 | /* check whether we've discovered any unique objects (primarily the |
| 936 | invocation items; the Guidebook calls unique items "relics" but the |
| 937 | Amulet of Yendor is unique too so we haven't made a blanket change |
| 938 | from 'u' to 'r') */ |
| 939 | for (i = 0; i < SIZE(uniq_objs); i++) { |
| 940 | uidx = uniq_objs[i]; |
| 941 | if (objects[uidx].oc_name_known |
| 942 | || (objects[uidx].oc_encountered && uidx != AMULET_OF_YENDOR)) { |
| 943 | Strcat(discosyms, "u"); |
| 944 | if (!traditional) { |
| 945 | any.a_int = 'u'; |
| 946 | /* FIXME: having 'r' as an accelerator to provide an unseen |
| 947 | synonym works but doesn't make much sense since the main |
nothing calls this directly
no test coverage detected