MCPcopy Index your code
hub / github.com/NetHack/NetHack / identify_pack

Function identify_pack

src/invent.c:2710–2745  ·  view source on GitHub ↗

dialog with user to identify a given number of items; 0 means all */

Source from the content-addressed store, hash-verified

2708
2709/* dialog with user to identify a given number of items; 0 means all */
2710void
2711identify_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 */

Callers 3

throne_sit_effectFunction · 0.85
invent.cFile · 0.85
seffect_identifyFunction · 0.85

Calls 7

count_unidentifiedFunction · 0.85
YouFunction · 0.85
not_fully_identifiedFunction · 0.85
identifyFunction · 0.85
ggetobjFunction · 0.85
menu_identifyFunction · 0.85
update_inventoryFunction · 0.85

Tested by

no test coverage detected