]> granicus.if.org Git - nethack/commitdiff
^X feedback when held by unseen monster
authorPatR <rankin@nethack.org>
Tue, 13 Apr 2021 21:50:12 +0000 (14:50 -0700)
committerPatR <rankin@nethack.org>
Tue, 13 Apr 2021 21:50:12 +0000 (14:50 -0700)
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.

include/mextra.h
src/do_name.c
src/insight.c

index 4d15157d939733db84066d926507a0f8148e3cdb..bd47aae2d6a148eb62f3d765a393d62f6f31c361 100644 (file)
@@ -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)
index 534cc25996ec6894bb5f14232040f5fbdb29a10e..1438500e2fbc194cfdadd809dd1818bc1a78af9e 100644 (file)
@@ -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;
 }
index aabde690ba576be27c4033295ebeca33138d7010..cbc332911c5295900ef32d8c42f6a26f4284e16f 100644 (file)
@@ -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) {