unpaid object: sanity check, teleporting, 'I u'
It turns out that there are some objects marked unpaid that aren't carried by the hero, so the recent sanity check for unpaid/no_charge could complain. Unpaid items dropped on the shop boundary (gap in shop wall, doorway, shk's free spot) stayed unpaid when dropped onto the floor, similar to recent change for pushed shop-owned boulders. Don't give sanity complaints for those. They could be all the way inside a shop too, where unpaid items in a gap in the shop wall got pushed into the shop when the wall was repaired. (Possibly those should come off the bill instead of remaining unpaid.) Teleporting items out of a shop was marking them unpaid instead of treating that as robbery. That's a bug caught by the sanity check. rloco() was also marking shop items which got teleported from one spot inside the shop to another spot inside the same shop as unpaid. Fix both of those things. Also, if an unpaid item on the boundary gets teleported all the way inside, take it off the bill. Change 'I u' to mention whether there are additional unpaid items on the floor somewhere since they won't be part of unpaid inventory and they're not on the used-up bill either. It might occasionally help the player figure out why the shopkeeper won't let the hero out of the shop.
This commit is contained in:
17
src/mkobj.c
17
src/mkobj.c
@@ -2784,7 +2784,7 @@ shop_obj_sanity(struct obj *obj, const char *mesg)
|
||||
struct obj *otop;
|
||||
struct monst *shkp;
|
||||
const char *why;
|
||||
boolean costly;
|
||||
boolean costly, costlytoo;
|
||||
coordxy x = 0, y = 0;
|
||||
|
||||
/* if contained, get top-most container; we needs its location */
|
||||
@@ -2800,17 +2800,22 @@ shop_obj_sanity(struct obj *obj, const char *mesg)
|
||||
/* these will always be needed for the normal case, so don't bother
|
||||
waiting until we find an insanity to fetch them */
|
||||
shkp = find_objowner(obj, x, y);
|
||||
costly = costly_spot(x, y) || costly_adjacent(shkp, x, y);
|
||||
costly = costly_spot(x, y);
|
||||
costlytoo = costly_adjacent(shkp, x, y);
|
||||
|
||||
why = (const char *) 0;
|
||||
if (obj->no_charge && obj->unpaid) {
|
||||
why = "%s obj both unpaid and no_charge! %s %s: %s";
|
||||
} else if (obj->unpaid) {
|
||||
/* unpaid is only applicable for directly carried objects and
|
||||
for objects inside carried containers */
|
||||
if (otop->where != OBJ_INVENT)
|
||||
/* unpaid is only applicable for directly carried objects, for
|
||||
objects inside carried containers, and for floor items outside
|
||||
the shop proper but within the shop boundary (walls, door, "free
|
||||
spot") and for objects moved from such spots into the shop proper
|
||||
by repair of shop walls */
|
||||
if (otop->where != OBJ_INVENT
|
||||
&& (otop->where != OBJ_FLOOR || (!costly && !costlytoo)))
|
||||
why = "%s unpaid obj not carried! %s %s: %s";
|
||||
else if (!costly)
|
||||
else if (!costly && !costlytoo)
|
||||
why = "%s unpaid obj not inside tended shop! %s %s: %s";
|
||||
else if (!shkp)
|
||||
why = "%s unpaid obj inside untended shop! %s %s: %s";
|
||||
|
||||
Reference in New Issue
Block a user