attempt to fix github issue #965 - place_object

Issue reported for a hardfought player by k2:  dying in a shop wall
produced "place_object: <item> [0] off map <0,0>" when hero's invent
was dropped.  It happened in Mine Town where multiple shopkeepers are
present and it is possible to have two shops share a wall.

I could not reprouce the problem, even after setting up--and dying
various times at a gap in--a wall shared by two shops.

paybill() -> inherits() -> set_repo_loc() sets up the destination
prior to disclosure and finish_paybill() -> drop_upon_death() later
places invent at the spot iff bones are going to he saved.  inherits()
is convoluted and evidently took at least one path that failed to
call set_repo_loc().  Change it to always call set_repo_loc() when
returning 'True' so that the destination should always be set if
really_done() calls finish_paybill().

Some followups by entrez are probably still useful.

Closes #965
This commit is contained in:
PatR
2023-02-06 11:47:37 -08:00
parent 7401b44fa1
commit 1d06fa62a9
3 changed files with 66 additions and 28 deletions

View File

@@ -2166,6 +2166,12 @@ place_object(struct obj *otmp, coordxy x, coordxy y)
: impossible;
(*func)("place_object: \"%s\" [%d] off map <%d,%d>",
safe_typename(otmp->otyp), otmp->where, x, y);
/* we'll only get to here if we've issued a warning (and fuzzer
is not running since it escalates impossible to panic), so
x,y has failed isok() but is within array bounds for the map;
in other words, x specifies column 0 which should not happen
but we let the game keep going */
}
if (otmp->where != OBJ_FREE)
panic("place_object: obj \"%s\" [%d] not free",