]> granicus.if.org Git - nethack/commitdiff
enhanced look-at-self
authorPatR <rankin@nethack.org>
Fri, 10 Jan 2020 00:59:30 +0000 (16:59 -0800)
committerPatR <rankin@nethack.org>
Fri, 10 Jan 2020 00:59:30 +0000 (16:59 -0800)
^X reports whether you're caught in a trap, but neither looking at
yourself (via '//' or ';' or other getpos autodescribe) nor looking
"here" (via ':') said anything about that.  Make looking at yourself
do so.

src/pager.c

index 24e0e278330857b4c7baba64e61d65e6e0a1d1da..48bdda9d09925c5cbd7f226086d4f40a05852dd1 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 pager.c $NHDT-Date: 1578137709 2020/01/04 11:35:09 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.179 $ */
+/* NetHack 3.6 pager.c $NHDT-Date: 1578617964 2020/01/10 00:59:24 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.180 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -91,6 +91,23 @@ char *outbuf;
         Sprintf(eos(outbuf), ", mounted on %s", y_monnam(u.usteed));
     if (u.uundetected || (Upolyd && U_AP_TYPE))
         mhidden_description(&g.youmonst, FALSE, eos(outbuf));
+    if (Punished)
+        Sprintf(eos(outbuf), ", chained to %s",
+                uball ? ansimpleoname(uball) : "nothing?");
+    if (u.utrap) {
+        if (u.utraptype == TT_BURIEDBALL) {
+            Strcat(outbuf, ", tethered to something buried");
+        } else if (u.utraptype == TT_INFLOOR || u.utraptype == TT_LAVA) {
+            Sprintf(eos(outbuf), ", stuck in %s", the(surface(u.ux, u.uy)));
+        } else { /* bear trap, [spiked] pit, or web */
+            struct trap *t = t_at(u.ux, u.uy);
+
+            Strcat(outbuf, ", trapped");
+            if (t)
+                Sprintf(eos(outbuf), " in %s",
+                        an(trapname(t->ttyp, FALSE)));
+        }
+    }
     return outbuf;
 }
 
@@ -106,7 +123,7 @@ char *outbuf;
     boolean fakeobj, isyou = (mon == &g.youmonst);
     int x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my,
         glyph = (g.level.flags.hero_memory && !isyou) ? levl[x][y].glyph
-                                                    : glyph_at(x, y);
+                                                      : glyph_at(x, y);
 
     *outbuf = '\0';
     if (M_AP_TYPE(mon) == M_AP_FURNITURE
@@ -144,8 +161,7 @@ char *outbuf;
             Strcat(outbuf, something);
         } else if (is_hider(mon->data)) {
             Sprintf(eos(outbuf), " on the %s",
-                    (is_flyer(mon->data) || mon->data->mlet == S_PIERCER)
-                       ? "ceiling"
+                    ceiling_hider(mon->data) ? "ceiling"
                        : surface(x, y)); /* trapper */
         } else {
             if (mon->data->mlet == S_EEL && is_pool(x, y))