sortloot ordering for holy/unholy water

When items were sorted alphabetically, holy water ended up in the H's
and unholy water in the U's.  Force them to get placed with water in
the W's, as would happen if water wasn't given an alternate name when
blessed or cursed.
This commit is contained in:
PatR
2016-04-23 15:44:26 -07:00
parent 0956054b30
commit 4750c0a303
2 changed files with 16 additions and 4 deletions

View File

@@ -218,6 +218,8 @@ if monster shapechange message "<foo> turns into <bar>!" was given, <bar>
could be "it" (if <foo> sensed telepathically and <bar> is mindless)
automatic annotation for Ft.Ludios level got applied when a drawbridge became
mapped, but entry there is a secret door rather than a drawbridge
sortloot changed to group holy water and unholy water with water instead of
placing them among the h- and u-named items
post-3.6.0: fix "object lost" panic during pickup caused by sortloot revamp
post-3.6.0: more sortloot revisions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 invent.c $NHDT-Date: 1461110442 2016/04/20 00:00:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.205 $ */
/* NetHack 3.6 invent.c $NHDT-Date: 1461451444 2016/04/23 22:44:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.206 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -64,7 +64,7 @@ const genericptr vptr2;
*sli2 = (struct sortloot_item *) vptr2;
struct obj *obj1 = sli1->obj,
*obj2 = sli2->obj;
char *cls1, *cls2;
char *cls1, *cls2, nam1[BUFSZ], nam2[BUFSZ];
int val1, val2, c, namcmp;
/* order by object class like inventory display */
@@ -139,8 +139,18 @@ const genericptr vptr2;
if ((sortlootmode & SORTLOOT_LOOT) == 0)
goto tiebreak;
/* Sort object names in lexicographical order, ignoring quantity. */
if ((namcmp = strcmpi(cxname_singular(obj1), cxname_singular(obj2))) != 0)
/* Sort object names in lexicographical order, ignoring quantity.
[Force holy and unholy water to sort adjacent to water rather
than among 'h's and 'u's. BUCX order will keep them distinct.] */
Strcpy(nam1, cxname_singular(obj1));
if (obj1->otyp == POT_WATER && obj1->bknown
&& (obj1->blessed || obj1->cursed))
(void) strsubst(nam1, obj1->blessed ? "holy " : "unholy ", "");
Strcpy(nam2, cxname_singular(obj2));
if (obj2->otyp == POT_WATER && obj2->bknown
&& (obj2->blessed || obj2->cursed))
(void) strsubst(nam2, obj2->blessed ? "holy " : "unholy ", "");
if ((namcmp = strcmpi(nam1, nam2)) != 0)
return namcmp;
/* Sort by BUCX. Map blessed to 4, uncursed to 2, cursed to 1, and