From: PatR Date: Tue, 13 Apr 2021 21:50:12 +0000 (-0700) Subject: ^X feedback when held by unseen monster X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=519f00e3c4e475ef46b4a8efae1bcd3d774f9f30;p=nethack ^X feedback when held by unseen monster When swallowed and blind, the swallowing monster is described accurately, but being held rather than swallowed describes the monster as "it". That's normal, but the status feedback section of ^X output lists |You are held by it. which looks pretty weird. Change that to be |You are held by an unseen creature. --- diff --git a/include/mextra.h b/include/mextra.h index 4d15157d9..bd47aae2d 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -18,7 +18,8 @@ * 2. Add a pointer to your new struct to the mextra struct in this * file. * 3. Add a referencing macro at bottom of this file after the mextra - * struct (see MGIVENNAME, EGD, EPRI, ESHK, EMIN, or EDOG for examples). + * struct (see MGIVENNAME, EGD, EPRI, ESHK, EMIN, or EDOG for + * examples). * 4. If your new field isn't a pointer and requires a non-zero value * on initialization, add code to init_mextra() in src/makemon.c * 5. Create a newXX(mtmp) function and possibly a free_XX(mtmp) diff --git a/src/do_name.c b/src/do_name.c index 534cc2599..1438500e2 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -2044,13 +2044,15 @@ minimal_monnam(struct monst *mon, boolean ckloc) } else if (ckloc && ptr == &mons[PM_LONG_WORM] && g.level.monsters[mon->mx][mon->my] != mon) { Sprintf(outbuf, "%s <%d,%d>", - pmname(&mons[PM_LONG_WORM_TAIL], Mgender(mon)), mon->mx, mon->my); + pmname(&mons[PM_LONG_WORM_TAIL], Mgender(mon)), + mon->mx, mon->my); } else { Sprintf(outbuf, "%s%s <%d,%d>", mon->mtame ? "tame " : mon->mpeaceful ? "peaceful " : "", pmname(mon->data, Mgender(mon)), mon->mx, mon->my); if (mon->cham != NON_PM) - Sprintf(eos(outbuf), "{%s}", pmname(&mons[mon->cham], Mgender(mon))); + Sprintf(eos(outbuf), "{%s}", + pmname(&mons[mon->cham], Mgender(mon))); } return outbuf; } diff --git a/src/insight.c b/src/insight.c index aabde690b..cbc332911 100644 --- a/src/insight.c +++ b/src/insight.c @@ -750,7 +750,7 @@ status_enlightenment(int mode, int final) { boolean magic = (mode & MAGICENLIGHTENMENT) ? TRUE : FALSE; int cap; - char buf[BUFSZ], youtoo[BUFSZ]; + char buf[BUFSZ], youtoo[BUFSZ], heldmon[BUFSZ]; boolean Riding = (u.usteed /* if hero dies while dismounting, u.usteed will still be set; we want to ignore steed in that situation */ @@ -906,10 +906,18 @@ status_enlightenment(int mode, int final) } else you_are(predicament, ""); } /* (u.utrap) */ + heldmon[0] = '\0'; /* lint suppression */ + if (u.ustuck) { /* includes u.uswallow */ + Strcpy(heldmon, a_monnam(u.ustuck)); + if (!strcmp(heldmon, "it") + && (!has_mgivenname(u.ustuck) + || strcmp(MGIVENNAME(u.ustuck), "it") != 0)) + Strcpy(heldmon, "an unseen createure"); + } if (u.uswallow) { /* implies u.ustuck is non-Null */ Sprintf(buf, "%s by %s", is_animal(u.ustuck->data) ? "swallowed" : "engulfed", - a_monnam(u.ustuck)); + heldmon); if (dmgtype(u.ustuck->data, AD_DGST)) { /* if final, death via digestion can be deduced by u.uswallow still being True and u.uswldtim having been decremented to 0 */ @@ -927,7 +935,7 @@ status_enlightenment(int mode, int final) int dx = u.ustuck->mx - u.ux, dy = u.ustuck->my - u.uy; Sprintf(buf, "%s %s (%s)", ustick ? "holding" : "held by", - a_monnam(u.ustuck), dxdy_to_dist_descr(dx, dy, TRUE)); + heldmon, dxdy_to_dist_descr(dx, dy, TRUE)); you_are(buf, ""); } if (Riding) {