dialog with user to identify a given number of items; 0 means all */
| 2708 | |
| 2709 | /* dialog with user to identify a given number of items; 0 means all */ |
| 2710 | void |
| 2711 | identify_pack( |
| 2712 | int id_limit, |
| 2713 | boolean learning_id) /* T: just read unknown identify scroll */ |
| 2714 | { |
| 2715 | struct obj *obj; |
| 2716 | int n, unid_cnt = count_unidentified(gi.invent); |
| 2717 | |
| 2718 | if (!unid_cnt) { |
| 2719 | You("have already identified %s of your possessions.", |
| 2720 | !learning_id ? "all" : "the rest"); |
| 2721 | } else if (!id_limit || id_limit >= unid_cnt) { |
| 2722 | /* identify everything */ |
| 2723 | /* TODO: use fully_identify_obj and cornline/menu/whatever here */ |
| 2724 | for (obj = gi.invent; obj; obj = obj->nobj) { |
| 2725 | if (not_fully_identified(obj)) { |
| 2726 | (void) identify(obj); |
| 2727 | if (--unid_cnt < 1) |
| 2728 | break; |
| 2729 | } |
| 2730 | } |
| 2731 | } else { |
| 2732 | /* identify up to `id_limit' items */ |
| 2733 | n = 0; |
| 2734 | if (flags.menu_style == MENU_TRADITIONAL) |
| 2735 | do { |
| 2736 | n = ggetobj("identify", identify, id_limit, FALSE, |
| 2737 | (unsigned *) 0); |
| 2738 | if (n < 0) |
| 2739 | break; /* quit or no eligible items */ |
| 2740 | } while ((id_limit -= n) > 0); |
| 2741 | if (n == 0 || n < -1) |
| 2742 | menu_identify(id_limit); |
| 2743 | } |
| 2744 | update_inventory(); |
| 2745 | } |
| 2746 | |
| 2747 | /* called when regaining sight; mark inventory objects which were picked |
| 2748 | up while blind as now having been seen */ |
no test coverage detected