more fixes for revised 'sortloot'
After some permutation of commands which displayed items, the 'd' command presented a prompt with the list of letters scrambled (in loot order or pack order rather than invlet order), so explicitly sort when getobj operates. Done for ggetobj too. For menustyle:Traditional, ',' followed by 'm' presented a pickup list in pile order even when sortloot was 'l' or 'f'. That was an unintentional change during the 'revamp'.
This commit is contained in:
@@ -193,6 +193,7 @@ female gnome who gains level can grow up into male-only gnome lord; give an
|
||||
kicked weapon which successfully hits monster vanishes from play
|
||||
unseen landmine explosion could result in "The <monst-type> statue crumbles."
|
||||
post-3.6.0: fix "object lost" panic during pickup caused by sortloot revamp
|
||||
post-3.6.0: more sortloot revisions
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -2197,6 +2197,7 @@ register boolean newlev;
|
||||
*ptr2 = '\0';
|
||||
}
|
||||
|
||||
/* possibly deliver a one-time room entry message */
|
||||
void
|
||||
check_special_room(newlev)
|
||||
register boolean newlev;
|
||||
@@ -2327,11 +2328,13 @@ register boolean newlev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* the ',' command */
|
||||
int
|
||||
dopickup()
|
||||
{
|
||||
int count;
|
||||
struct trap *traphere = t_at(u.ux, u.uy);
|
||||
|
||||
/* awful kludge to work around parse()'s pre-decrement */
|
||||
count = (multi || (save_cm && *save_cm == ',')) ? multi + 1 : 0;
|
||||
multi = 0; /* always reset */
|
||||
@@ -2372,6 +2375,7 @@ dopickup()
|
||||
}
|
||||
if (!OBJ_AT(u.ux, u.uy)) {
|
||||
register struct rm *lev = &levl[u.ux][u.uy];
|
||||
|
||||
if (IS_THRONE(lev->typ))
|
||||
pline("It must weigh%s a ton!", lev->looted ? " almost" : "");
|
||||
else if (IS_SINK(lev->typ))
|
||||
|
||||
53
src/invent.c
53
src/invent.c
@@ -1106,6 +1106,13 @@ register const char *let, *word;
|
||||
|
||||
if (!flags.invlet_constant)
|
||||
reassign();
|
||||
else
|
||||
/* in case invent is in packorder, force it to be in invlet
|
||||
order before collecing candidate inventory letters;
|
||||
if player responds with '?' or '*' it will be changed
|
||||
back by display_pickinv(), but by then we'll have 'lets'
|
||||
and so won't have to re-sort in the for(;;) loop below */
|
||||
sortloot(&invent, SORTLOOT_INVLET, FALSE);
|
||||
|
||||
for (otmp = firstobj; otmp; otmp = otmp->nobj) {
|
||||
if (&bp[foo] == &buf[sizeof buf - 1]
|
||||
@@ -1119,8 +1126,8 @@ register const char *let, *word;
|
||||
|| (usegold && otmp->invlet == GOLD_SYM)
|
||||
|| (useboulder && otmp->otyp == BOULDER)) {
|
||||
register int otyp = otmp->otyp;
|
||||
bp[foo++] = otmp->invlet;
|
||||
|
||||
bp[foo++] = otmp->invlet;
|
||||
/* clang-format off */
|
||||
/* *INDENT-OFF* */
|
||||
/* ugly check: remove inappropriate things */
|
||||
@@ -1521,9 +1528,9 @@ static NEARDATA const char removeables[] = { ARMOR_CLASS, WEAPON_CLASS,
|
||||
RING_CLASS, AMULET_CLASS,
|
||||
TOOL_CLASS, 0 };
|
||||
|
||||
/* interactive version of getobj - used for Drop, Identify and */
|
||||
/* Takeoff (A). Return the number of times fn was called successfully */
|
||||
/* If combo is TRUE, we just use this to get a category list */
|
||||
/* Interactive version of getobj - used for Drop, Identify, and Takeoff (A).
|
||||
Return the number of times fn was called successfully.
|
||||
If combo is TRUE, we just use this to get a category list. */
|
||||
int
|
||||
ggetobj(word, fn, mx, combo, resultflags)
|
||||
const char *word;
|
||||
@@ -1700,15 +1707,15 @@ unsigned *resultflags;
|
||||
* Walk through the chain starting at objchn and ask for all objects
|
||||
* with olet in olets (if nonNULL) and satisfying ckfn (if nonnull)
|
||||
* whether the action in question (i.e., fn) has to be performed.
|
||||
* If allflag then no questions are asked. Max gives the max nr of
|
||||
* objects to be treated. Return the number of objects treated.
|
||||
* If allflag then no questions are asked. Mx gives the max number
|
||||
* of objects to be treated. Return the number of objects treated.
|
||||
*/
|
||||
int
|
||||
askchain(objchn, olets, allflag, fn, ckfn, mx, word)
|
||||
struct obj **objchn;
|
||||
register int allflag, mx;
|
||||
register const char *olets, *word; /* olets is an Obj Class char array */
|
||||
register int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P));
|
||||
int allflag, mx;
|
||||
const char *olets, *word; /* olets is an Obj Class char array */
|
||||
int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P));
|
||||
{
|
||||
struct obj *otmp, *otmpo;
|
||||
register char sym, ilet;
|
||||
@@ -1723,11 +1730,17 @@ register int FDECL((*fn), (OBJ_P)), FDECL((*ckfn), (OBJ_P));
|
||||
nodot = (!strcmp(word, "nodot") || !strcmp(word, "drop") || ident
|
||||
|| takeoff || take_out || put_in);
|
||||
ininv = (*objchn == invent);
|
||||
|
||||
/* someday maybe we'll sort by 'olets' too (temporarily replace
|
||||
flags.packorder and pass SORTLOOT_PACK), but not yet... */
|
||||
sortloot(objchn, SORTLOOT_INVLET, FALSE);
|
||||
|
||||
first = TRUE;
|
||||
/* Changed so the askchain is interrogated in the order specified.
|
||||
* For example, if a person specifies =/ then first all rings will be
|
||||
* asked about followed by all wands -dgk
|
||||
*/
|
||||
/*
|
||||
* Interrogate in the object class order specified.
|
||||
* For example, if a person specifies =/ then first all rings
|
||||
* will be asked about followed by all wands. -dgk
|
||||
*/
|
||||
nextclass:
|
||||
ilet = 'a' - 1;
|
||||
if (*objchn && (*objchn)->oclass == COIN_CLASS)
|
||||
@@ -1770,9 +1783,10 @@ nextclass:
|
||||
Sprintf(qpfx, "%s: ", word), *qpfx = highc(*qpfx);
|
||||
first = FALSE;
|
||||
}
|
||||
(void) safe_qbuf(
|
||||
qbuf, qpfx, "?", otmp, ininv ? safeq_xprname : doname,
|
||||
ininv ? safeq_shortxprname : ansimpleoname, "item");
|
||||
(void) safe_qbuf(qbuf, qpfx, "?", otmp,
|
||||
ininv ? safeq_xprname : doname,
|
||||
ininv ? safeq_shortxprname : ansimpleoname,
|
||||
"item");
|
||||
sym = (takeoff || ident || otmp->quan < 2L) ? nyaq(qbuf)
|
||||
: nyNaq(qbuf);
|
||||
} else
|
||||
@@ -1784,11 +1798,10 @@ nextclass:
|
||||
to 'none' or 'all'. 2 special cases: cursed loadstones and
|
||||
welded weapons (eg, multiple daggers) will remain as merged
|
||||
unit; done to avoid splitting an object that won't be
|
||||
droppable (even if we're picking up rather than dropping).
|
||||
*/
|
||||
if (!yn_number)
|
||||
droppable (even if we're picking up rather than dropping). */
|
||||
if (!yn_number) {
|
||||
sym = 'n';
|
||||
else {
|
||||
} else {
|
||||
sym = 'y';
|
||||
if (yn_number < otmp->quan && splittable(otmp))
|
||||
otmp = splitobj(otmp, yn_number);
|
||||
|
||||
@@ -823,7 +823,7 @@ boolean FDECL((*allow), (OBJ_P)); /* allow function */
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sorted) {
|
||||
if (sorted || flags.sortloot != 'n') {
|
||||
sortloot(&olist,
|
||||
(((flags.sortloot == 'f'
|
||||
|| (flags.sortloot == 'l' && !(qflags & USE_INVLET)))
|
||||
|
||||
Reference in New Issue
Block a user