Unpaid globs showed weight info unconditionally outside of wizmode

globwt() didn't check for wizmode, so unpaid globs would be shown with weight
information even for normal player.

Eliminated globwt() completely and consolidated the output of aum in one place
as we don't really care about the ordering of debug info in wizmode.
This commit is contained in:
Patric Mueller
2020-01-08 11:26:40 +01:00
parent df50d4cf17
commit 2965488525
2 changed files with 9 additions and 28 deletions

View File

@@ -35,6 +35,7 @@ make earthquake which hits a secret door or a secret corridor reveal it
wizard mode wishing for "Amulet of Yendor" has 50:50 chance for true Amulet
or a cheap plastic imitation; recognize "real Amulet of Yendor" and
"fake Amulet of Yendor" to precisely specify either of them
unpaid globs showed weight info unconditionally outside of wizmode
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -24,7 +24,6 @@ static boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
static char *FDECL(singplur_compound, (char *));
static char *FDECL(xname_flags, (struct obj *, unsigned));
static boolean FDECL(badman, (const char *, BOOLEAN_P));
static char *FDECL(globwt, (struct obj *, char *, boolean *));
struct Jitem {
int item;
@@ -926,8 +925,7 @@ unsigned doname_flags;
{
boolean ispoisoned = FALSE,
with_price = (doname_flags & DONAME_WITH_PRICE) != 0,
vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0,
weightshown = FALSE;
vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0;
boolean known, dknown, cknown, bknown, lknown;
int omndx = obj->corpsenm;
char prefix[PREFIX], globbuf[QBUFSZ];
@@ -1258,22 +1256,19 @@ unsigned doname_flags;
} else if (is_unpaid(obj)) { /* in inventory or in container in invent */
long quotedprice = unpaid_cost(obj, TRUE);
Sprintf(eos(bp), " (%s, %s%ld %s)",
Sprintf(eos(bp), " (%s, %ld %s)",
obj->unpaid ? "unpaid" : "contents",
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);
if (price > 0L)
Sprintf(eos(bp), " (%s, %s%ld %s)",
Sprintf(eos(bp), " (%s, %ld %s)",
nochrg ? "contents" : "for sale",
globwt(obj, globbuf, &weightshown),
price, currency(price));
else if (nochrg > 0)
Sprintf(eos(bp), " (%sno charge)",
globwt(obj, globbuf, &weightshown));
Sprintf(eos(bp), " (no charge)");
}
if (!strncmp(prefix, "a ", 2)) {
/* save current prefix, without "a "; might be empty */
@@ -1287,9 +1282,10 @@ unsigned doname_flags;
/* show weight for items (debug tourist info);
"aum" is stolen from Crawl's "Arbitrary Unit of Measure" */
if (wizard && iflags.wizweight) {
/* wizard mode user has asked to see object weights;
globs with shop pricing attached already include it */
if (!weightshown)
/* wizard mode user has asked to see object weights */
if (with_price && (*(eos(bp)-1) == ')'))
Sprintf(eos(bp)-1, ", %u aum)", obj->owt);
else
Sprintf(eos(bp), " (%u aum)", obj->owt);
}
bp = strprepend(bp, prefix);
@@ -4486,20 +4482,4 @@ const char *lastR;
return qbuf;
}
static char *
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;
}
/*objnam.c*/