simplify #wizidentify

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.
This commit is contained in:
PatR
2018-09-24 17:06:04 -07:00
parent 8ce81a27ef
commit d119eca297
3 changed files with 28 additions and 30 deletions
+3 -2
View 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 "$:" setting the inverse attribute for gold had the space before "$:"
getting highlighted along with the gold field getting highlighted along with the gold field
sortloot segfaulted when filtering a subset of items (seen with 'A' command) 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 tty: turn off an optimization that is the suspected cause of Windows reported
partial status lines following level changes partial status lines following level changes
tty: ensure that current status fields are always copied to prior status tty: ensure that current status fields are always copied to prior status
values so that comparisons are correct 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 X11: its use of genl_status_update exposed a negative index use that could
lead to a segfault lead to a segfault
make long extended commands list be more navigable
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+3 -6
View File
@@ -747,14 +747,11 @@ wiz_identify(VOID_ARGS)
/* command remapping might leave #wizidentify as the only way /* command remapping might leave #wizidentify as the only way
to invoke us, in which case cmd_from_func() will yield NUL; to invoke us, in which case cmd_from_func() will yield NUL;
it won't matter to display_inventory()/display_pickinv() it won't matter to display_inventory()/display_pickinv()
if ^I invokes some other command--what matters is that it if ^I invokes some other command--what matters is that
is never an inventory letter */ display_pickinv() and xname() see override_ID as nonzero */
if (!iflags.override_ID) if (!iflags.override_ID)
iflags.override_ID = C('I'); iflags.override_ID = C('I');
/* C('I') == ^I == default keystroke for wiz_identify; (void) display_inventory((char *) 0, FALSE);
it doesn't matter whether the command has been remapped */
if (display_inventory((char *) 0, TRUE) == C('I'))
identify_pack(0, FALSE);
iflags.override_ID = 0; iflags.override_ID = 0;
} else } else
pline("Unavailable command '%s'.", pline("Unavailable command '%s'.",
+22 -22
View File
@@ -2593,24 +2593,27 @@ long *out_cnt;
char prompt[QBUFSZ]; char prompt[QBUFSZ];
unid_cnt = count_unidentified(invent); unid_cnt = count_unidentified(invent);
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, Sprintf(prompt, "Debug Identify"); /* 'title' rather than 'prompt' */
"Debug Identify", if (unid_cnt)
MENU_UNSELECTED); 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) { if (!unid_cnt) {
add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE,
"(all items are permanently identified already)", "(all items are permanently identified already)",
MENU_UNSELECTED); MENU_UNSELECTED);
} else { } else {
any.a_obj = &wizid_fakeobj; 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) /* wiz_identify stuffed the wiz_identify command character (^I)
into iflags.override_ID for our use as an accelerator; into iflags.override_ID for our use as an accelerator;
it could be ambiguous as a selector but the only time it it could be ambiguous if player has assigned a letter to
is wanted is in case where no item is being selected */ the #wizidentify command */
Sprintf(prompt, if (unid_cnt > 1)
"Select %sthe %d bolded item%s to permanently identify (%s for all)", Sprintf(eos(prompt), " (%s for all)",
(unid_cnt == 1) ? "": "any of ", unid_cnt, visctrl(iflags.override_ID));
(unid_cnt > 1) ? "s" : "",
visctrl(iflags.override_ID));
add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE, add_menu(win, NO_GLYPH, &any, '_', iflags.override_ID, ATR_NONE,
prompt, MENU_UNSELECTED); prompt, MENU_UNSELECTED);
wizid = TRUE; wizid = TRUE;
@@ -2630,6 +2633,8 @@ nextclass:
if (lets && !index(lets, otmp->invlet)) if (lets && !index(lets, otmp->invlet))
continue; continue;
if (!flags.sortpack || otmp->oclass == *invlet) { if (!flags.sortpack || otmp->oclass == *invlet) {
if (wizid && !not_fully_identified(otmp))
continue;
any = zeroany; /* all bits zero */ any = zeroany; /* all bits zero */
ilet = otmp->invlet; ilet = otmp->invlet;
if (flags.sortpack && !classcount) { if (flags.sortpack && !classcount) {
@@ -2643,9 +2648,7 @@ nextclass:
any.a_obj = otmp; any.a_obj = otmp;
else else
any.a_char = ilet; any.a_char = ilet;
add_menu(win, obj_to_glyph(otmp), &any, ilet, 0, add_menu(win, obj_to_glyph(otmp), &any, ilet, 0, ATR_NONE,
(wizid && not_fully_identified(otmp)) ?
ATR_BOLD : ATR_NONE,
doname(otmp), MENU_UNSELECTED); doname(otmp), MENU_UNSELECTED);
} }
} }
@@ -2678,21 +2681,18 @@ nextclass:
} }
end_menu(win, query && *query ? query : (char *) 0); end_menu(win, query && *query ? query : (char *) 0);
n = select_menu(win, wizid ? PICK_ANY : n = select_menu(win,
want_reply ? PICK_ONE : PICK_NONE, &selected); wizid ? PICK_ANY : want_reply ? PICK_ONE : PICK_NONE,
&selected);
if (n > 0) { if (n > 0) {
if (wizid) { if (wizid) {
int i = n; int i;
ret = '\0'; ret = '\0';
while (--i >= 0) { for (i = 0; i < n; ++i) {
otmp = selected[i].item.a_obj; otmp = selected[i].item.a_obj;
if (otmp == &wizid_fakeobj) { if (otmp == &wizid_fakeobj) {
/* C('I') == ^I == default keystroke for wiz_identify; identify_pack(0, FALSE);
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');
} else { } else {
if (not_fully_identified(otmp)) if (not_fully_identified(otmp))
(void) identify(otmp); (void) identify(otmp);