wizweight vs globs

The wizard mode runtime option 'wizweight' appends an object's weight
to its formatted description, but that was skipped for globs on the
assumption that it had already been included.  But that inclusion only
happens in shops so most globs lacked weight feedback.
This commit is contained in:
PatR
2019-06-10 09:52:34 -07:00
parent 5d59b288c9
commit 9ee6e1c839
2 changed files with 24 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.50 $ $NHDT-Date: 1560161804 2019/06/10 10:16:44 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.51 $ $NHDT-Date: 1560185545 2019/06/10 16:52:25 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -83,6 +83,8 @@ using ^G to create "hidden mimic" shouldn't have marked it as undetected since
mimics 'hide' be appearing to be something else; honor "hidden" for
'hides_under' creatures if/when created at location with object(s),
also for eels and other fish if/when created at water location
for wizard mode 'wizweight' option, glob weight wasn't shown unless glob had
shop price information attached
curses: sometimes the message window would show a blank line after a prompt

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1559670607 2019/06/04 17:50:07 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.242 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1560185545 2019/06/10 16:52:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.243 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -25,7 +25,7 @@ STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
STATIC_DCL char *FDECL(singplur_compound, (char *));
STATIC_DCL char *FDECL(xname_flags, (struct obj *, unsigned));
STATIC_DCL boolean FDECL(badman, (const char *, BOOLEAN_P));
STATIC_DCL char *FDECL(globwt, (struct obj *, char *));
STATIC_DCL char *FDECL(globwt, (struct obj *, char *, boolean *));
struct Jitem {
int item;
@@ -932,7 +932,8 @@ unsigned doname_flags;
{
boolean ispoisoned = FALSE,
with_price = (doname_flags & DONAME_WITH_PRICE) != 0,
vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0;
vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0,
weightshown = FALSE;
boolean known, dknown, cknown, bknown, lknown;
int omndx = obj->corpsenm;
char prefix[PREFIX], globbuf[QBUFSZ];
@@ -1243,7 +1244,8 @@ unsigned doname_flags;
Sprintf(eos(bp), " (%s, %s%ld %s)",
obj->unpaid ? "unpaid" : "contents",
globwt(obj, globbuf), quotedprice, currency(quotedprice));
globwt(obj, globbuf, &weightshown),
quotedprice, currency(quotedprice));
} else if (with_price) { /* on floor or in container on floor */
int nochrg = 0;
long price = get_cost_of_shop_item(obj, &nochrg);
@@ -1251,9 +1253,11 @@ unsigned doname_flags;
if (price > 0L)
Sprintf(eos(bp), " (%s, %s%ld %s)",
nochrg ? "contents" : "for sale",
globwt(obj, globbuf), price, currency(price));
globwt(obj, globbuf, &weightshown),
price, currency(price));
else if (nochrg > 0)
Sprintf(eos(bp), " (%sno charge)", globwt(obj, globbuf));
Sprintf(eos(bp), " (%sno charge)",
globwt(obj, globbuf, &weightshown));
}
if (!strncmp(prefix, "a ", 2)) {
/* save current prefix, without "a "; might be empty */
@@ -1264,11 +1268,13 @@ unsigned doname_flags;
Strcat(prefix, tmpbuf);
}
/* show weight for items (debug tourist info)
* aum is stolen from Crawl's "Arbitrary Unit of Measure" */
/* show weight for items (debug tourist info);
"aum" is stolen from Crawl's "Arbitrary Unit of Measure" */
if (wizard && iflags.wizweight) {
if (!obj->globby) /* aum already apparent for globs */
Sprintf(eos(bp), " (%d aum)", obj->owt);
/* wizard mode user has asked to see object weights;
globs with shop pricing attached already include it */
if (!weightshown)
Sprintf(eos(bp), " (%u aum)", obj->owt);
}
bp = strprepend(bp, prefix);
return bp;
@@ -4230,13 +4236,17 @@ const char *lastR;
}
STATIC_OVL char *
globwt(otmp, buf)
globwt(otmp, buf, weightformatted_p)
struct obj *otmp;
char *buf;
boolean *weightformatted_p;
{
*buf = '\0';
if (otmp->globby) {
Sprintf(buf, "%u aum, ", otmp->owt);
*weightformatted_p = TRUE;
} else {
*weightformatted_p = FALSE;
}
return buf;
}