shrinking globs vs shop bill
A shop-owned glob picked up by the hero was added to shop's bill and if that shrank to nothing it moved from the unpaid portion to used-up portion as intended. But once there it retained obj->owt of 0 and if 'sanity_check' was enabled, that triggered a warning every move until finally paid for. Both the 'Ix' list of used-up items and itemized shop billing revealed a weight of 0 aum if 'wizweight' was enabled. Keep track of the weight a glob had when it becomes unpaid, then reset from 0 to that amount if it becomes used-up. This overloads the obj->oextra->omid field which is an unsigned int previously only used for corpses. Now for globs it is pre-bill obj->owt which is also unsigned int. I didn't add new oextra access functions for it; it is only used in two places and existing omid ones suffice.
This commit is contained in:
@@ -900,6 +900,9 @@ misaligned potion colors due to lack of reset_glyphmap() following obj shuffle;
|
||||
closed doors were described as "horizontal closed door" or "vertical closed
|
||||
door" instead of just "closed door"
|
||||
glob shrinkage while hero was away from glob's level wasn't handled properly
|
||||
unpaid shop-owned glob that shrank to nothing had weight 0 which triggered
|
||||
onbill warnings when 'sanity_check' was On; for 'Ix' and itemized
|
||||
billing, the empty weight was shown to player if 'wizweight' was On
|
||||
|
||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||
also included tty support
|
||||
|
||||
@@ -23,7 +23,8 @@ struct oextra {
|
||||
char *oname; /* ptr to name of object */
|
||||
struct monst *omonst; /* ptr to attached monst struct */
|
||||
char *omailcmd; /* response_cmd for mail delivery */
|
||||
unsigned omid; /* for corpse; m_id of corpse's ghost */
|
||||
unsigned omid; /* for corpse: m_id of corpse's ghost; overloaded
|
||||
* for glob: owt at time added to shop's bill */
|
||||
};
|
||||
|
||||
struct obj {
|
||||
|
||||
11
src/shk.c
11
src/shk.c
@@ -946,6 +946,10 @@ obfree(register struct obj* obj, register struct obj* merge)
|
||||
if (!merge) {
|
||||
bp->useup = 1;
|
||||
obj->unpaid = 0; /* only for doinvbill */
|
||||
/* for used up glob, put back origial weight in case it gets
|
||||
formatted ('I x' or itemized billing) with 'wizweight' On */
|
||||
if (obj->globby && !obj->owt && has_omid(obj))
|
||||
obj->owt = OMID(obj);
|
||||
add_to_billobjs(obj);
|
||||
return;
|
||||
}
|
||||
@@ -2483,9 +2487,14 @@ add_one_tobill(struct obj *obj, boolean dummy, struct monst *shkp)
|
||||
} else
|
||||
bp->useup = 0;
|
||||
bp->price = get_cost(obj, shkp);
|
||||
if (obj->globby)
|
||||
if (obj->globby) {
|
||||
/* for globs, the amt charged for quan 1 depends on owt */
|
||||
bp->price *= get_pricing_units(obj);
|
||||
/* remember the weight this glob had when it was added to bill;
|
||||
glob oextra_owt field overlays corpse omid field */
|
||||
newomid(obj);
|
||||
OMID(obj) = obj->owt;
|
||||
}
|
||||
eshkp->billct++;
|
||||
obj->unpaid = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user