refine paranoid_confirm:Autoall

If confirmation for menustyle:Full 'A' choice is on and player
chooses 'A' but answers no at the "Really autoselect All?" prompt,
just remove 'A' from the list of choices and act on the rest.  If it
was the only choice, the menu operation will behave as if no choices
had been made.  (That was the previous behavior even when other
choices were also present.)  But when other choices have been made
along with 'A', use them without 'A':  the normal second menu will
be put up, listing objects matching the specified classes and not
autoselecting anything.
This commit is contained in:
PatR
2023-06-24 12:56:41 -07:00
parent 079ea3a449
commit 456a87fdc6

View File

@@ -1355,14 +1355,20 @@ query_category(
}
end_menu(win, qstr);
n = select_menu(win, how, pick_list);
/* handle ParanoidAutoAll by confirming 'A' choice if present */
if (n > 0 && verify_All) {
int i;
int i, j;
for (i = 0; i < n; ++i)
if (pick_list[i]->item.a_int == 'A') {
if ((*pick_list)[i].item.a_int == 'A') {
if (y_n("Really autoselect All?") != 'y') {
n = 0;
free((genericptr_t) *pick_list);
/* answer is "no", so take 'A' out of the list;
if it is the only entry, we'll return nothing,
otherwise go on to next menu without autoselect */
for (j = i + 1; j < n; ++j)
(*pick_list)[j - 1] = (*pick_list)[j];
if (!--n)
free((genericptr_t) *pick_list), *pick_list = 0;
}
break; /* goto query_done; */
}
@@ -1370,7 +1376,7 @@ query_category(
query_done:
destroy_nhwindow(win);
if (n < 0)
n = 0; /* caller's don't expect -1 */
n = 0; /* callers don't expect -1 */
return n;
}