add '?' choice after choosing '* for force_invmenu
If the force_invmenu option is On for choosing an inventory item and the set of likely candidates is only a subset of full inventory, then "* (list everything)" is an extra menu choice. If the player picks that, the menu is reissued showing entire inventory (with the extra "* (list everyhing)" choice omitted this time). When that happens, add "? (list likely candidates)" instead, so that the menu can be toggled back to how it initially was. If the menu allows choosing anything in inventory (the 'd' command, for instance), it will already show full inventory and neither '*' nor '?' gets included as helper choices.
This commit is contained in:
+37
-28
@@ -1764,7 +1764,7 @@ getobj(
|
|||||||
} else if (cq.typ == CMDQ_INT) {
|
} else if (cq.typ == CMDQ_INT) {
|
||||||
/* getting a partial stack */
|
/* getting a partial stack */
|
||||||
if (!cntgiven && allowcnt) {
|
if (!cntgiven && allowcnt) {
|
||||||
cnt = cq.intval;
|
cnt = (long) cq.intval;
|
||||||
cntgiven = TRUE;
|
cntgiven = TRUE;
|
||||||
goto need_more_cq; /* now, get CMDQ_KEY */
|
goto need_more_cq; /* now, get CMDQ_KEY */
|
||||||
} else {
|
} else {
|
||||||
@@ -1773,11 +1773,11 @@ getobj(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!otmp) /* didn't find what we were looking for, */
|
if (!otmp) { /* didn't find what we were looking for, */
|
||||||
cmdq_clear(CQ_CANNED); /* so discard any other queued cmnds */
|
cmdq_clear(CQ_CANNED); /* so discard any other queued cmnds */
|
||||||
else if (cntgiven) {
|
} else if (cntgiven) {
|
||||||
/* if stack is smaller than count, drop the whole stack */
|
/* if stack is smaller than count, drop the whole stack */
|
||||||
if (cnt < 1 || otmp->quan <= cnt)
|
if (cnt < 1L || otmp->quan <= cnt)
|
||||||
cntgiven = FALSE;
|
cntgiven = FALSE;
|
||||||
goto split_otmp;
|
goto split_otmp;
|
||||||
}
|
}
|
||||||
@@ -1873,7 +1873,7 @@ getobj(
|
|||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
cnt = 0;
|
cnt = 0L;
|
||||||
cntgiven = FALSE;
|
cntgiven = FALSE;
|
||||||
Sprintf(qbuf, "What do you want to %s?", word);
|
Sprintf(qbuf, "What do you want to %s?", word);
|
||||||
if (gi.in_doagain) {
|
if (gi.in_doagain) {
|
||||||
@@ -1894,7 +1894,7 @@ getobj(
|
|||||||
ilet = yn_function(qbuf, (char *) 0, '\0', FALSE);
|
ilet = yn_function(qbuf, (char *) 0, '\0', FALSE);
|
||||||
}
|
}
|
||||||
if (digit(ilet)) {
|
if (digit(ilet)) {
|
||||||
long tmpcnt = 0;
|
long tmpcnt = 0L;
|
||||||
|
|
||||||
if (!allowcnt) {
|
if (!allowcnt) {
|
||||||
pline("No count allowed with this command.");
|
pline("No count allowed with this command.");
|
||||||
@@ -1921,7 +1921,7 @@ getobj(
|
|||||||
select-from-invent before checking whether gold has been picked */
|
select-from-invent before checking whether gold has been picked */
|
||||||
if (ilet == '?' || ilet == '*') {
|
if (ilet == '?' || ilet == '*') {
|
||||||
char *allowed_choices = (ilet == '?') ? lets : (char *) 0;
|
char *allowed_choices = (ilet == '?') ? lets : (char *) 0;
|
||||||
long ctmp = 0;
|
long ctmp = 0L;
|
||||||
char menuquery[QBUFSZ];
|
char menuquery[QBUFSZ];
|
||||||
char *handsbuf = (char *) 0;
|
char *handsbuf = (char *) 0;
|
||||||
|
|
||||||
@@ -1950,9 +1950,9 @@ getobj(
|
|||||||
pline1(Never_mind);
|
pline1(Never_mind);
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
}
|
}
|
||||||
if (ilet == '*')
|
if (ilet == '*' || ilet == '?')
|
||||||
goto redo_menu;
|
goto redo_menu;
|
||||||
if (allowcnt && ctmp >= 0) {
|
if (allowcnt && ctmp >= 0L) {
|
||||||
cnt = ctmp;
|
cnt = ctmp;
|
||||||
cntgiven = TRUE;
|
cntgiven = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1977,10 +1977,10 @@ getobj(
|
|||||||
* gold pieces was allowed, and did interesting things to
|
* gold pieces was allowed, and did interesting things to
|
||||||
* your money supply. The LRS is the tax bureau from Larn.
|
* your money supply. The LRS is the tax bureau from Larn.
|
||||||
*/
|
*/
|
||||||
if (cntgiven && cnt <= 0) {
|
if (cntgiven && cnt <= 0L) {
|
||||||
if (cnt < 0)
|
if (cnt < 0L)
|
||||||
pline_The(
|
pline_The("LRS would be very interested to know"
|
||||||
"LRS would be very interested to know you have that much.");
|
" you have that much.");
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2007,7 +2007,7 @@ getobj(
|
|||||||
}
|
}
|
||||||
disp.botl = TRUE; /* May have changed the amount of money */
|
disp.botl = TRUE; /* May have changed the amount of money */
|
||||||
if (otmp && !gi.in_doagain) {
|
if (otmp && !gi.in_doagain) {
|
||||||
if (cntgiven && cnt > 0)
|
if (cntgiven && cnt > 0L)
|
||||||
cmdq_add_int(CQ_REPEAT, cnt);
|
cmdq_add_int(CQ_REPEAT, cnt);
|
||||||
cmdq_add_key(CQ_REPEAT, ilet);
|
cmdq_add_key(CQ_REPEAT, ilet);
|
||||||
}
|
}
|
||||||
@@ -2019,7 +2019,7 @@ getobj(
|
|||||||
if (gi.in_doagain)
|
if (gi.in_doagain)
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
continue;
|
continue;
|
||||||
} else if (cnt < 0 || otmp->quan < cnt) {
|
} else if (cnt < 0L || otmp->quan < cnt) {
|
||||||
You("don't have that many! You have only %ld.", otmp->quan);
|
You("don't have that many! You have only %ld.", otmp->quan);
|
||||||
if (gi.in_doagain)
|
if (gi.in_doagain)
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
@@ -2033,7 +2033,7 @@ getobj(
|
|||||||
}
|
}
|
||||||
split_otmp:
|
split_otmp:
|
||||||
if (cntgiven) {
|
if (cntgiven) {
|
||||||
if (cnt == 0)
|
if (cnt == 0L)
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
if (cnt != otmp->quan) {
|
if (cnt != otmp->quan) {
|
||||||
/* don't split a stack of cursed loadstones */
|
/* don't split a stack of cursed loadstones */
|
||||||
@@ -3866,19 +3866,28 @@ display_pickinv(
|
|||||||
if (save_flags_sortpack != flags.sortpack)
|
if (save_flags_sortpack != flags.sortpack)
|
||||||
flags.sortpack = save_flags_sortpack;
|
flags.sortpack = save_flags_sortpack;
|
||||||
|
|
||||||
/* default for force_invmenu is a list of likely candidates;
|
/* default for force_invmenu is a menu listing likely candidates;
|
||||||
add '*' for 'show all' as an extra choice unless list already
|
add '*' for 'list all' as an extra choice unless the menu already
|
||||||
includes everything; won't work via keyboard if current menu
|
includes everything; when reissuing the menu after player has
|
||||||
uses '*' as group accelerator for gems but might work via mouse */
|
picked '*', add '?' for 'list likely candidates' to reverse that */
|
||||||
if (iflags.force_invmenu && lets && want_reply
|
if (iflags.force_invmenu && want_reply) {
|
||||||
&& ((allowxtra && !usextra)
|
const char *menutext = NULL;
|
||||||
|| (int) strlen(lets) < inv_cnt(TRUE))) {
|
|
||||||
any = cg.zeroany;
|
any = cg.zeroany;
|
||||||
add_menu_heading(win, "Special");
|
if ((allowxtra && !usextra)
|
||||||
any.a_char = '*';
|
|| (lets && (int) strlen(lets) < inv_cnt(TRUE))) {
|
||||||
add_menu(win, &nul_glyphinfo, &any, '*', 0, ATR_NONE, clr,
|
any.a_char = '*';
|
||||||
"(list everything)", MENU_ITEMFLAGS_NONE);
|
menutext = "(list everything)";
|
||||||
gotsomething = TRUE;
|
} else if (!lets) {
|
||||||
|
any.a_char = '?';
|
||||||
|
menutext = "(list likely candidates)";
|
||||||
|
}
|
||||||
|
if (menutext) {
|
||||||
|
add_menu_heading(win, "Special");
|
||||||
|
add_menu(win, &nul_glyphinfo, &any, any.a_char, 0, ATR_NONE, clr,
|
||||||
|
menutext, MENU_ITEMFLAGS_NONE);
|
||||||
|
gotsomething = TRUE; /* menu isn't empty */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unsortloot(&sortedinvent);
|
unsortloot(&sortedinvent);
|
||||||
/* for permanent inventory where nothing has been listed (because
|
/* for permanent inventory where nothing has been listed (because
|
||||||
|
|||||||
Reference in New Issue
Block a user