From f6761c7d22c9a0c16ad7cb094ccce82eb8dff8db Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 28 Apr 2026 01:54:33 -0400 Subject: [PATCH] fix an impossible() on pick-up from stomach --- doc/fixes3-7-0.txt | 5 ++++- src/pickup.c | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index aa27902a7..d9a068c73 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -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 diff --git a/src/pickup.c b/src/pickup.c index 5f6e55de8..4b5a1c573 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -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);