fix some billing and pricing issues when globs coalesce

payment issue caused by glob coalescing
glob pricing did not consider coalesced weight
This commit is contained in:
nhmall
2019-05-17 12:04:01 -04:00
parent 53f208c48b
commit 2aee73642d
6 changed files with 181 additions and 11 deletions

View File

@@ -25,6 +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 *));
struct Jitem {
int item;
@@ -1219,11 +1220,12 @@ unsigned doname_flags;
} else if (with_price) { /* on floor or in container on floor */
int nochrg = 0;
long price = get_cost_of_shop_item(obj, &nochrg);
char globbuf[BUFSZ];
if (price > 0L)
Sprintf(eos(bp), " (%s, %ld %s)",
Sprintf(eos(bp), " (%s, %s%ld %s)",
nochrg ? "contents" : "for sale",
price, currency(price));
globwt(obj, globbuf), price, currency(price));
else if (nochrg > 0)
Strcat(bp, " (no charge)");
}
@@ -4200,4 +4202,16 @@ const char *lastR;
return qbuf;
}
STATIC_OVL char *
globwt(otmp, buf)
struct obj *otmp;
char *buf;
{
if (otmp && buf && otmp->globby && otmp->quan == 1L) {
Sprintf(buf, "%ld aum, ", otmp->owt);
return buf;
}
return "";
}
/*objnam.c*/