menustyle:full's 'A' choice

Change how menu choice 'A' (auto-select everything) works.  It will
now auto-select all things that match any other choices (object
class(es) or BUCX state(s) or possibly unpaid status).  So it still
skips the second menu of specific objects.  And it still picks all
objects when it is the only choice or if player uses '.' to select
it along with all the rest of the first menu's possibilities.

This change won't help anyone who picks 'A' without really meaning
to.  (Maybe add a paranoid_confirm setting to for full-menu-A?)

Affects container apply/#loot and Drop-multiple.  The invent.c part
is just formatting.
This commit is contained in:
PatR
2021-04-02 12:26:41 -07:00
parent a86ebb943a
commit b65c93cdff
4 changed files with 64 additions and 39 deletions

View File

@@ -289,14 +289,15 @@ loot_xname(struct obj *obj)
return res;
}
/* '$'==1, 'a'-'z'==2..27, 'A'-'Z'==28..53, '#'==54, catchall 55 */
static int
invletter_value(char c)
{
return ('a' <= c && c <= 'z') ? (c - 'a' + 2)
: ('A' <= c && c <= 'Z') ? (c - 'A' + 2 + 26)
: (c == '$') ? 1
: (c == '#') ? 1 + 52 + 1
: 1 + 52 + 1 + 1; /* none of the above */
: ('A' <= c && c <= 'Z') ? (c - 'A' + 2 + 26)
: (c == '$') ? 1
: (c == '#') ? 1 + 52 + 1
: 1 + 52 + 1 + 1; /* none of the above (shouldn't happen) */
}
/* qsort comparison routine for sortloot() */
@@ -467,10 +468,11 @@ sortloot_cmp(const genericptr vptr1, const genericptr vptr2)
* instead of simple 'struct obj *' entries.
*/
Loot *
sortloot(struct obj **olist, /* previous version might have changed *olist, we don't */
unsigned mode, /* flags for sortloot_cmp() */
boolean by_nexthere, /* T: traverse via obj->nexthere, F: via obj->nobj */
boolean (*filterfunc)(OBJ_P))
sortloot(
struct obj **olist, /* old version might have changed *olist, we don't */
unsigned mode, /* flags for sortloot_cmp() */
boolean by_nexthere, /* T: traverse via obj->nexthere, F: via obj->nobj */
boolean (*filterfunc)(struct obj *)) /* optional filter */
{
Loot *sliarray;
struct obj *o;
@@ -527,11 +529,12 @@ unsortloot(Loot **loot_array_p)
free((genericptr_t) *loot_array_p), *loot_array_p = (Loot *) 0;
}
#if 0 /* 3.6.0 'revamp' */
#if 0 /* 3.6.0 'revamp' -- simpler than current, but ultimately too simple */
void
sortloot(struct obj **olist, unsigned mode, /* flags for sortloot_cmp() */
boolean by_nexthere) /* T: traverse via obj->nexthere,
F: via obj->nobj */
sortloot(
struct obj **olist,
unsigned mode, /* flags for sortloot_cmp() */
boolean by_nexthere) /* T: traverse via obj->nexthere, F: via obj->nobj */
{
struct sortloot_item *sliarray, osli, nsli;
struct obj *o, **nxt_p;
@@ -623,7 +626,7 @@ reorder_invent(void)
* isn't nearly as inefficient as it may first appear.
*/
need_more_sorting = FALSE;
for (otmp = g.invent, prev = 0; otmp;) {
for (otmp = g.invent, prev = 0; otmp; ) {
next = otmp->nobj;
if (next && inv_rank(next) < inv_rank(otmp)) {
need_more_sorting = TRUE;