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:34:53 +01:00
parent df50d4cf17
commit 2965488525
2 changed files with 9 additions and 28 deletions
+1
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 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 or a cheap plastic imitation; recognize "real Amulet of Yendor" and
"fake Amulet of Yendor" to precisely specify either of them "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 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+8 -28
View File
@@ -24,7 +24,6 @@ static boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
static char *FDECL(singplur_compound, (char *)); static char *FDECL(singplur_compound, (char *));
static char *FDECL(xname_flags, (struct obj *, unsigned)); static char *FDECL(xname_flags, (struct obj *, unsigned));
static boolean FDECL(badman, (const char *, BOOLEAN_P)); static boolean FDECL(badman, (const char *, BOOLEAN_P));
static char *FDECL(globwt, (struct obj *, char *, boolean *));
struct Jitem { struct Jitem {
int item; int item;
@@ -926,8 +925,7 @@ unsigned doname_flags;
{ {
boolean ispoisoned = FALSE, boolean ispoisoned = FALSE,
with_price = (doname_flags & DONAME_WITH_PRICE) != 0, 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; boolean known, dknown, cknown, bknown, lknown;
int omndx = obj->corpsenm; int omndx = obj->corpsenm;
char prefix[PREFIX], globbuf[QBUFSZ]; char prefix[PREFIX], globbuf[QBUFSZ];
@@ -1258,22 +1256,19 @@ unsigned doname_flags;
} else if (is_unpaid(obj)) { /* in inventory or in container in invent */ } else if (is_unpaid(obj)) { /* in inventory or in container in invent */
long quotedprice = unpaid_cost(obj, TRUE); long quotedprice = unpaid_cost(obj, TRUE);
Sprintf(eos(bp), " (%s, %s%ld %s)", Sprintf(eos(bp), " (%s, %ld %s)",
obj->unpaid ? "unpaid" : "contents", obj->unpaid ? "unpaid" : "contents",
globwt(obj, globbuf, &weightshown),
quotedprice, currency(quotedprice)); quotedprice, currency(quotedprice));
} else if (with_price) { /* on floor or in container on floor */ } else if (with_price) { /* on floor or in container on floor */
int nochrg = 0; int nochrg = 0;
long price = get_cost_of_shop_item(obj, &nochrg); long price = get_cost_of_shop_item(obj, &nochrg);
if (price > 0L) if (price > 0L)
Sprintf(eos(bp), " (%s, %s%ld %s)", Sprintf(eos(bp), " (%s, %ld %s)",
nochrg ? "contents" : "for sale", nochrg ? "contents" : "for sale",
globwt(obj, globbuf, &weightshown),
price, currency(price)); price, currency(price));
else if (nochrg > 0) else if (nochrg > 0)
Sprintf(eos(bp), " (%sno charge)", Sprintf(eos(bp), " (no charge)");
globwt(obj, globbuf, &weightshown));
} }
if (!strncmp(prefix, "a ", 2)) { if (!strncmp(prefix, "a ", 2)) {
/* save current prefix, without "a "; might be empty */ /* save current prefix, without "a "; might be empty */
@@ -1287,9 +1282,10 @@ unsigned doname_flags;
/* show weight for items (debug tourist info); /* show weight for items (debug tourist info);
"aum" is stolen from Crawl's "Arbitrary Unit of Measure" */ "aum" is stolen from Crawl's "Arbitrary Unit of Measure" */
if (wizard && iflags.wizweight) { if (wizard && iflags.wizweight) {
/* wizard mode user has asked to see object weights; /* wizard mode user has asked to see object weights */
globs with shop pricing attached already include it */ if (with_price && (*(eos(bp)-1) == ')'))
if (!weightshown) Sprintf(eos(bp)-1, ", %u aum)", obj->owt);
else
Sprintf(eos(bp), " (%u aum)", obj->owt); Sprintf(eos(bp), " (%u aum)", obj->owt);
} }
bp = strprepend(bp, prefix); bp = strprepend(bp, prefix);
@@ -4486,20 +4482,4 @@ const char *lastR;
return qbuf; 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*/ /*objnam.c*/