]> granicus.if.org Git - nethack/commitdiff
senseself()/canspotself()
authornethack.rankin <nethack.rankin>
Sat, 18 Jun 2005 04:38:50 +0000 (04:38 +0000)
committernethack.rankin <nethack.rankin>
Sat, 18 Jun 2005 04:38:50 +0000 (04:38 +0000)
     Make the names of the macros for handling the hero be similar to those
for monsters (where mis-use of `sensemon()' was the cause of a recently
reported bug).  `senseself()' becomes more restrictive in what it specifies,
and current uses of it are replaced by new `canspotself()'.

include/display.h
src/display.c
src/pager.c

index 8a184ce00b2b87ae2d6b6981be23b6c282ba2634..08a0eef7935660e496998bd96b21654fcb2e56ea 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)display.h  3.5     1999/11/30      */
+/*     SCCS Id: @(#)display.h  3.5     2005/06/21      */
 /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
 /* and Dave Cohrs, 1990.                                         */
 /* NetHack may be freely redistributed.  See license for details. */
 /*
  * canseeself()
  * senseself()
+ * canspotself()
  *
  * This returns true if the hero can see her/himself.
  *
- * The u.uswallow check assumes that you can see yourself even if you are
- * invisible.  If not, then we don't need the check.
+ * Sensing yourself by touch is treated as seeing yourself, even if
+ * unable to see.  So when blind, being invisible won't affect your
+ * self-perception, and when swallowed, the enclosing monster touches.
  */
 #define canseeself()   (Blind || u.uswallow || (!Invisible && !u.uundetected))
-#define senseself()    (canseeself() || Unblind_telepat || Detect_monsters)
+#define senseself()    (Unblind_telepat || Detect_monsters)
+#define canspotself()  (canseeself() || senseself())
 
 /*
  * random_monster()
index e165b31c6bb3c20f7a6c636545bae3537031f1de..85ac929d88c1e28756cff0d7f07eceaee1cb3796 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)display.c  3.5     2003/02/19      */
+/*     SCCS Id: @(#)display.c  3.5     2005/06/21      */
 /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
 /* and Dave Cohrs, 1990.                                         */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -672,7 +672,7 @@ newsym(x,y)
            return;
        }
        if (x == u.ux && y == u.uy) {
-           if (senseself()) {
+           if (canspotself()) {
                _map_location(x,y,0);   /* map *under* self */
                display_self();
            } else
@@ -714,7 +714,7 @@ newsym(x,y)
        if (x == u.ux && y == u.uy) {
            feel_location(u.ux, u.uy);          /* forces an update */
 
-           if (senseself()) display_self();
+           if (canspotself()) display_self();
        }
        else if ((mon = m_at(x,y))
                && ((see_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
index 8f9a495555bcce5e17d2539971bd3230d5bd8b54..fa9a2043aaa89924b151e563846a38aeb4b7fc44 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)pager.c    3.5     2003/08/13      */
+/*     SCCS Id: @(#)pager.c    3.5     2005/06/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -64,7 +64,7 @@ lookat(x, y, buf, monbuf)
 
     buf[0] = monbuf[0] = 0;
     glyph = glyph_at(x,y);
-    if (u.ux == x && u.uy == y && senseself()) {
+    if (u.ux == x && u.uy == y && canspotself()) {
        char race[QBUFSZ];
 
        /* if not polymorphed, show both the role and the race */