menu of unidentified objects; select and identify up to id_limit of them */
| 2657 | |
| 2658 | /* menu of unidentified objects; select and identify up to id_limit of them */ |
| 2659 | staticfn void |
| 2660 | menu_identify(int id_limit) |
| 2661 | { |
| 2662 | menu_item *pick_list; |
| 2663 | int n, i, first = 1, tryct = 5; |
| 2664 | char buf[BUFSZ]; |
| 2665 | /* assumptions: id_limit > 0 and at least one unID'd item is present */ |
| 2666 | |
| 2667 | while (id_limit) { |
| 2668 | Sprintf(buf, "What would you like to identify %s?", |
| 2669 | first ? "first" : "next"); |
| 2670 | n = query_objlist(buf, &gi.invent, (SIGNAL_NOMENU | SIGNAL_ESCAPE |
| 2671 | | USE_INVLET | INVORDER_SORT), |
| 2672 | &pick_list, PICK_ANY, not_fully_identified); |
| 2673 | |
| 2674 | if (n > 0) { |
| 2675 | if (n > id_limit) |
| 2676 | n = id_limit; |
| 2677 | for (i = 0; i < n; i++, id_limit--) |
| 2678 | (void) identify(pick_list[i].item.a_obj); |
| 2679 | free((genericptr_t) pick_list); |
| 2680 | if (id_limit) |
| 2681 | wait_synch(); /* Before we loop to pop open another menu */ |
| 2682 | first = 0; |
| 2683 | } else if (n == -2) { /* player used ESC to quit menu */ |
| 2684 | break; |
| 2685 | } else if (n == -1) { /* no eligible items found */ |
| 2686 | pline("That was all."); |
| 2687 | break; |
| 2688 | } else if (!--tryct) { /* stop re-prompting */ |
| 2689 | pline1(thats_enough_tries); |
| 2690 | break; |
| 2691 | } else { /* try again */ |
| 2692 | pline("Choose an item; use ESC to decline."); |
| 2693 | } |
| 2694 | } |
| 2695 | } |
| 2696 | /* count the unidentified items */ |
| 2697 | int |
| 2698 | count_unidentified(struct obj *objchn) |
no test coverage detected