| 2961 | invent subsets specified by the ')', '[', '(', '=', '"', or '*' commands |
| 2962 | when they're invoked with the 'm' prefix (or without it for '*') */ |
| 2963 | staticfn int |
| 2964 | dispinv_with_action( |
| 2965 | char *lets, /* list of invlet values to include */ |
| 2966 | boolean use_inuse_ordering, /* affects sortloot() and header labels */ |
| 2967 | const char *alt_label) /* alternate value for in-use "Accessories" */ |
| 2968 | { |
| 2969 | struct obj *otmp, *nextobj; |
| 2970 | const char *save_accessories = 0; |
| 2971 | char c, save_sortloot = 0; |
| 2972 | unsigned len = lets ? (unsigned) strlen(lets) : 0U; |
| 2973 | boolean menumode = (len != 1 || iflags.menu_requested) ? TRUE : FALSE, |
| 2974 | save_force_invmenu = iflags.force_invmenu; |
| 2975 | |
| 2976 | if (use_inuse_ordering) { |
| 2977 | save_accessories = inuse_headers[4]; |
| 2978 | save_sortloot = flags.sortloot; |
| 2979 | |
| 2980 | flags.sortloot = 'i'; /* checked by display_pickinv() */ |
| 2981 | if (alt_label) |
| 2982 | inuse_headers[4] = alt_label; |
| 2983 | } |
| 2984 | iflags.force_invmenu = FALSE; |
| 2985 | |
| 2986 | c = display_inventory(lets, menumode); |
| 2987 | |
| 2988 | if (use_inuse_ordering) { |
| 2989 | flags.sortloot = save_sortloot; |
| 2990 | inuse_headers[4] = save_accessories; |
| 2991 | } |
| 2992 | iflags.force_invmenu = save_force_invmenu; |
| 2993 | |
| 2994 | if (c && c != '\033') { |
| 2995 | for (otmp = gi.invent; otmp; otmp = nextobj) { |
| 2996 | nextobj = otmp->nobj; |
| 2997 | if (otmp->invlet == c) |
| 2998 | return itemactions(otmp); |
| 2999 | } |
| 3000 | } |
| 3001 | return ECMD_OK; |
| 3002 | } |
| 3003 | |
| 3004 | /* the #inventory command (not much left...) */ |
| 3005 | int |