Fix: bill_dummy_obj billed excessively for stacks

Add a way to request that unpaid_cost() produce the cost for a single
item, which is necessary for the price adjustment made in
bill_dummy_object.  Another option would be to simply divide by quan in
bill_dummy_object, but this might be more future-proof in case
unpaid_cost ever involves more than simple multiplication by quan
(e.g. the use of alternate units vs the base price, as are used for
globs).

Fixes #1236
This commit is contained in:
Michael Meyer
2024-04-27 11:22:48 -04:00
committed by PatR
parent 1f8db3a0f3
commit b662134eba
7 changed files with 24 additions and 11 deletions

View File

@@ -4110,7 +4110,7 @@ dounpaid(
}
if (otmp && !contnr) {
/* 1 item; use pline instead of popup menu */
cost = unpaid_cost(otmp, FALSE);
cost = unpaid_cost(otmp, COST_NOCONTENTS);
iflags.suppress_price++; /* suppress "(unpaid)" suffix */
pline1(xprname(otmp, distant_name(otmp, doname),
carried(otmp) ? otmp->invlet : CONTAINED_SYM,
@@ -4136,7 +4136,7 @@ dounpaid(
classcount++;
}
totcost += cost = unpaid_cost(otmp, FALSE);
totcost += cost = unpaid_cost(otmp, COST_NOCONTENTS);
iflags.suppress_price++; /* suppress "(unpaid)" suffix */
putstr(win, 0, xprname(otmp, distant_name(otmp, doname),
ilet, TRUE, cost, 0L));
@@ -4162,7 +4162,7 @@ dounpaid(
marker = (struct obj *) 0; /* haven't found any */
while (find_unpaid(otmp->cobj, &marker)) {
totcost += cost = unpaid_cost(marker, FALSE);
totcost += cost = unpaid_cost(marker, COST_NOCONTENTS);
contcost += cost;
if (otmp->cknown) {
iflags.suppress_price++; /* suppress "(unpaid)" sfx */