fix an impossible() on pick-up from stomach

This commit is contained in:
nhmall
2026-04-28 01:54:33 -04:00
parent a090ba90a1
commit f6761c7d22
2 changed files with 22 additions and 3 deletions
+4 -1
View File
@@ -2233,7 +2233,10 @@ when reading an engraving, suppress the addition of a trailing period if the
cursed magic whistle could teleport hero on no-teleport levels
give a brief explanation when receiving a wish for acquiring the Amulet
teleportation traps no longer teleport you on levels made temporarily
no-teleport by the presence of a monster
no-teleport by the presence of a monster
an attempt to pick up an object from a monster's stomach would trigger
an impossible() in newsym() due to object having no ox,oy coordinates
set; set the coordinates to the monster's at the start of pick_obj()
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
+18 -2
View File
@@ -1897,8 +1897,24 @@ struct obj *
pick_obj(struct obj *otmp)
{
struct obj *result;
int ox = otmp->ox, oy = otmp->oy;
boolean robshop = (!u.uswallow && otmp != uball && costly_spot(ox, oy));
int ox, oy;
boolean robshop = FALSE;
if (otmp->ox == 0 && otmp->oy == 0) {
if (u.uswallow && u.ustuck && otmp->where == OBJ_MINVENT
&& otmp->ocarry == u.ustuck) {
otmp->ox = u.ustuck->mx;
otmp->oy = u.ustuck->my;
} else {
/* this will be a problem for newsym below */
impossible("otmp has no location coordinates <%d, %d> where=%d.",
otmp->ox, otmp->oy, otmp->where);
}
}
ox = otmp->ox;
oy = otmp->oy;
robshop = (!u.uswallow && otmp != uball && costly_spot(ox, oy));
obj_extract_self(otmp);
newsym(ox, oy);