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:
PatR
2021-11-25 00:47:45 -08:00
parent 01b2bcff75
commit c0228d1a74
3 changed files with 15 additions and 2 deletions

View File

@@ -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 {