]> granicus.if.org Git - nethack/commitdiff
simplify #wizidentify
authorPatR <rankin@nethack.org>
Tue, 25 Sep 2018 00:06:04 +0000 (17:06 -0700)
committerPatR <rankin@nethack.org>
Tue, 25 Sep 2018 00:06:04 +0000 (17:06 -0700)
Get rid of bold/non-bold distinction in #wizidentify inventory menu
by only showing items which aren't yet fully identified instead of
full inventory with bold for unID'd.  Support for bold text might
be lacking.

I was considering this even before the report that X11 menus ignore
attribute.  The "_ - (use ^I for all)" menu entry is still present,
but it could be discarded in favor of '.' to pick everything via
ordinary menu selection.

doc/fixes36.2
src/cmd.c
src/invent.c

index 479c7287b975181b66fe1d996796bc00777afc2b..51e27582fea8b561e5e46594d8038df2fd669f19 100644 (file)
@@ -150,14 +150,15 @@ fix access violation when --debug:xxxx has no other args after it
 setting the inverse attribute for gold had the space before "$:"
        getting highlighted along with the gold field
 sortloot segfaulted when filtering a subset of items (seen with 'A' command)
+orctown: prevent Bad fruit #0 and some minor tuning
+make long extended commands list be more navigable
+simplify #wizidentify; don't rely on having bold menu entries
 tty: turn off an optimization that is the suspected cause of Windows reported 
        partial status lines following level changes
 tty: ensure that current status fields are always copied to prior status
        values so that comparisons are correct
-orctown: prevent Bad fruit #0 and some minor tuning
 X11: its use of genl_status_update exposed a negative index use that could
        lead to a segfault
-make long extended commands list be more navigable
 
 
 Platform- and/or Interface-Specific Fixes
index c698b06479ddc531ebf7300e4b3a4539286c8c93..d525356671aeaeddc53e4b0959559532ff2c1880 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -747,14 +747,11 @@ wiz_identify(VOID_ARGS)
         /* command remapping might leave #wizidentify as the only way
            to invoke us, in which case cmd_from_func() will yield NUL;
            it won't matter to display_inventory()/display_pickinv()
-           if ^I invokes some other command--what matters is that it
-           is never an inventory letter */
+           if ^I invokes some other command--what matters is that
+           display_pickinv() and xname() see override_ID as nonzero */
         if (!iflags.override_ID)
             iflags.override_ID = C('I');
-        /* C('I') == ^I == default keystroke for wiz_identify;
-           it doesn't matter whether the command has been remapped */
-        if (display_inventory((char *) 0, TRUE) == C('I'))
-            identify_pack(0, FALSE);
+        (void) display_inventory((char *) 0, FALSE);
         iflags.override_ID = 0;
     } else
         pline("Unavailable command '%s'.",
index 4262a5153100e0de1613df4a42774f1703e501fb..84e6367df18ba8fc924ff2cce7bed4c6a59c458d 100644 (file)
@@ -2593,24 +2593,27 @@ long *out_cnt;
         char prompt[QBUFSZ];
 
         unid_cnt = count_unidentified(invent); 
-        add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
-                     "Debug Identify",
-                     MENU_UNSELECTED);
+        Sprintf(prompt, "Debug Identify"); /* 'title' rather than 'prompt' */
+        if (unid_cnt)
+            Sprintf(eos(prompt),
+                    " -- unidentified or partially identified item%s",
+                    plur(unid_cnt));
+        add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, prompt, MENU_UNSELECTED);
         if (!unid_cnt) {
             add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
                      "(all items are permanently identified already)",
                      MENU_UNSELECTED);
         } else {
             any.a_obj = &wizid_fakeobj;
+            Sprintf(prompt, "select %s to permanently identify",
+                    (unid_cnt == 1) ? "it": "any or all of them");
             /* wiz_identify stuffed the wiz_identify command character (^I)
                into iflags.override_ID for our use as an accelerator;
-               it could be ambiguous as a selector but the only time it
-               is wanted is in case where no item is being selected */
-            Sprintf(prompt,
-          "Select %sthe %d bolded item%s to permanently identify (%s for all)",
-                    (unid_cnt == 1) ? "": "any of ", unid_cnt,
-                    (unid_cnt > 1) ? "s" : "",
-                    visctrl(iflags.override_ID));
+               it could be ambiguous if player has assigned a letter to
+               the #wizidentify command */
+            if (unid_cnt > 1)
+                Sprintf(eos(prompt), " (%s for all)",
+                        visctrl(iflags.override_ID));
             add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
                      prompt, MENU_UNSELECTED);
             wizid = TRUE;
@@ -2630,6 +2633,8 @@ nextclass:
         if (lets && !index(lets, otmp->invlet))
             continue;
         if (!flags.sortpack || otmp->oclass == *invlet) {
+            if (wizid && !not_fully_identified(otmp))
+                continue;
             any = zeroany; /* all bits zero */
             ilet = otmp->invlet;
             if (flags.sortpack && !classcount) {
@@ -2643,9 +2648,7 @@ nextclass:
                 any.a_obj = otmp;
             else
                 any.a_char = ilet;
-            add_menu(win, obj_to_glyph(otmp), &any, ilet, 0,
-                     (wizid && not_fully_identified(otmp)) ?
-                        ATR_BOLD : ATR_NONE,
+            add_menu(win, obj_to_glyph(otmp), &any, ilet, 0, ATR_NONE,
                      doname(otmp), MENU_UNSELECTED);
         }
     }
@@ -2678,21 +2681,18 @@ nextclass:
     }
     end_menu(win, query && *query ? query : (char *) 0);
 
-    n = select_menu(win, wizid ? PICK_ANY :
-                    want_reply ? PICK_ONE : PICK_NONE, &selected);
+    n = select_menu(win,
+                    wizid ? PICK_ANY : want_reply ? PICK_ONE : PICK_NONE,
+                    &selected);
     if (n > 0) {
         if (wizid) {
-            int i = n;
+            int i;
 
             ret = '\0';
-            while (--i >= 0) {
+            for (i = 0; i < n; ++i) {
                 otmp = selected[i].item.a_obj;
                 if (otmp == &wizid_fakeobj) {
-                    /* C('I') == ^I == default keystroke for wiz_identify;
-                       it is guaranteed not to be in use as an inventory letter
-                       (wiz_identify might be remapped to an ordinary letter,
-                       making iflags.override_ID ambiguous as a return value) */
-                       ret = C('I');
+                    identify_pack(0, FALSE);
                 } else {
                     if (not_fully_identified(otmp))
                         (void) identify(otmp);