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

@@ -2809,7 +2809,7 @@ extern long contained_gold(struct obj *, boolean) NONNULLARG1;
extern void picked_container(struct obj *) NONNULLARG1;
extern void gem_learned(int);
extern void alter_cost(struct obj *, long) NONNULLARG1;
extern long unpaid_cost(struct obj *, boolean) NONNULLARG1;
extern long unpaid_cost(struct obj *, uchar) NONNULLARG1;
extern boolean billable(struct monst **, struct obj *, char,
boolean) NONNULLARG12;
extern void addtobill(struct obj *, boolean, boolean, boolean) NONNULLARG1;

View File

@@ -308,6 +308,13 @@ enum cost_alteration_types {
COST_CRACK = 19, /* damage to crystal armor */
};
/* used by unpaid_cost(shk.h) */
enum unpaid_cost_flags {
COST_NOCONTENTS = 0,
COST_CONTENTS = 1,
COST_SINGLEOBJ = 2,
};
/* read.c, create_particular() & create_particular_parse() */
struct _create_particular_data {
int quan;