From f360cb24b1233a7b838d96db18b3660cabcc76d8 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 10 Nov 2023 16:35:43 -0500 Subject: [PATCH] allow monster that has swallowed hero to be named --- doc/fixes3-7-0.txt | 2 ++ src/do_name.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 2a8b3934d..8bf886447 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1278,6 +1278,8 @@ make spell menu work with repeat when attempting to look up a named fruit in data.base, try harder set and check mon->mstate flags more consistently fix sanity error when cloud was created over an engraving +docall naming of the monster that currently has the hero swallowed by + using their visible interior Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/do_name.c b/src/do_name.c index 5d074ed24..d50c61482 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -1335,6 +1335,7 @@ do_mgivenname(void) coord cc; int cx, cy; struct monst *mtmp = 0; + boolean do_swallow = FALSE; if (Hallucination) { You("would never recognize it anyway."); @@ -1358,12 +1359,23 @@ do_mgivenname(void) } else mtmp = m_at(cx, cy); - if (!mtmp + /* Allow you to name the monster that has swallowed you */ + if (!mtmp && u.uswallow) { + int glyph = glyph_at(cx, cy); + + if (glyph_is_swallow(glyph)) { + mtmp = u.ustuck; + do_swallow = TRUE; + } + } + + if (!do_swallow && (!mtmp || (!sensemon(mtmp) && (!(cansee(cx, cy) || see_with_infrared(mtmp)) || mtmp->mundetected || M_AP_TYPE(mtmp) == M_AP_FURNITURE || M_AP_TYPE(mtmp) == M_AP_OBJECT - || (mtmp->minvis && !See_invisible)))) { + || (mtmp->minvis && !See_invisible))))) { + pline("I see no monster there."); return; }