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