]> granicus.if.org Git - nethack/commitdiff
Unify blind feel_location or newsym info single func
authorPasi Kallinen <paxed@alt.org>
Mon, 9 Nov 2015 19:37:28 +0000 (21:37 +0200)
committerPasi Kallinen <paxed@alt.org>
Mon, 9 Nov 2015 19:37:28 +0000 (21:37 +0200)
include/extern.h
src/apply.c
src/detect.c
src/dig.c
src/display.c
src/dokick.c
src/lock.c
src/trap.c

index 7e5195cc8a1e7a113f60987ea7ebbe9d19b878ed..8f6bb1c84f471f52b43b559b6ded991d6a238dd8 100644 (file)
@@ -306,6 +306,7 @@ E void FDECL(map_object, (struct obj *, int));
 E void FDECL(map_invisible, (XCHAR_P, XCHAR_P));
 E void FDECL(unmap_object, (int, int));
 E void FDECL(map_location, (int, int, int));
+E void FDECL(feel_newsym, (XCHAR_P, XCHAR_P));
 E void FDECL(feel_location, (XCHAR_P, XCHAR_P));
 E void FDECL(newsym, (int, int));
 E void FDECL(shieldeff, (XCHAR_P, XCHAR_P));
index 9379fb24c35f28f7411b4cc13c17cb94fbeffaa8..952e5fa7b15c4b5d24bb3adf2834201d55343785 100644 (file)
@@ -401,19 +401,13 @@ register struct obj *obj;
     case SDOOR:
         You_hear(hollow_str, "door");
         cvt_sdoor_to_door(lev); /* ->typ = DOOR */
-        if (Blind)
-            feel_location(rx, ry);
-        else
-            newsym(rx, ry);
+        feel_newsym(rx, ry);
         return res;
     case SCORR:
         You_hear(hollow_str, "passage");
         lev->typ = CORR;
         unblock_point(rx, ry);
-        if (Blind)
-            feel_location(rx, ry);
-        else
-            newsym(rx, ry);
+        feel_newsym(rx, ry);
         return res;
     }
 
index c8f824eedadcb16e3a6407fc496d96a24d9bf920..f33ce713958a09bd9d5f7bb7d829ce579cab6d7b 100644 (file)
@@ -1291,10 +1291,7 @@ struct trap *trap;
 
     trap->tseen = 1;
     exercise(A_WIS, TRUE);
-    if (Blind)
-        feel_location(trap->tx, trap->ty);
-    else
-        newsym(trap->tx, trap->ty);
+    feel_newsym(trap->tx, trap->ty);
 
     if (levl[trap->tx][trap->ty].glyph != trap_to_glyph(trap)) {
         /* There's too much clutter to see your find otherwise */
index 0631c4365e4e7280079341a7c123cca7fb2e7193..17fcf4553a29a25534d42011234981eb623bee59 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -81,10 +81,7 @@ boolean waslit, rockit;
     lev->typ = (rockit ? STONE : ROOM);
     if (dist >= 3)
         impossible("mkcavepos called with dist %d", dist);
-    if (Blind)
-        feel_location(x, y);
-    else
-        newsym(x, y);
+    feel_newsym(x, y);
 }
 
 STATIC_OVL void
@@ -437,10 +434,7 @@ dig(VOID_ARGS)
 
         if (!does_block(dpx, dpy, &levl[dpx][dpy]))
             unblock_point(dpx, dpy); /* vision:  can see through */
-        if (Blind)
-            feel_location(dpx, dpy);
-        else
-            newsym(dpx, dpy);
+        feel_newsym(dpx, dpy);
         if (digtxt && !context.digging.quiet)
             pline1(digtxt); /* after newsym */
         if (dmgtxt)
index c6c7f7206476a52a4013b220d39a22f06b9745d9..e75f74d538e718441a097fcecc89055a22235239 100644 (file)
@@ -486,6 +486,23 @@ register struct monst *mon;
     show_glyph(x, y, glyph);
 }
 
+
+/*
+ * feel_newsym()
+ *
+ * When hero knows what happened to location, even when blind.
+ */
+void
+feel_newsym(x, y)
+xchar x, y;
+{
+    if (Blind)
+        feel_location(x, y);
+    else
+        newsym(x, y);
+}
+
+
 /*
  * feel_location()
  *
index 1f4d1b42a0219fb4621dde699d2e9f254da2f42e..ca4e2a6bc2225e055e0e1cba34aa0bd2e2769f1e 100644 (file)
@@ -973,10 +973,7 @@ dokick()
                 } else if (maploc->doormask != D_NODOOR
                            && !(maploc->doormask & D_LOCKED))
                     maploc->doormask = D_ISOPEN;
-                if (Blind)
-                    feel_location(x, y); /* we know it's gone */
-                else
-                    newsym(x, y);
+                feel_newsym(x, y); /* we know it's gone */
                 if (maploc->doormask == D_ISOPEN
                     || maploc->doormask == D_NODOOR)
                     unblock_point(x, y); /* vision */
@@ -989,10 +986,7 @@ dokick()
                 pline("Crash!  You kick open a secret passage!");
                 exercise(A_DEX, TRUE);
                 maploc->typ = CORR;
-                if (Blind)
-                    feel_location(x, y); /* we know it's gone */
-                else
-                    newsym(x, y);
+                feel_newsym(x, y); /* we know it's gone */
                 unblock_point(x, y); /* vision */
                 return 1;
             } else
@@ -1267,10 +1261,7 @@ dokick()
             exercise(A_STR, TRUE);
             maploc->doormask = D_BROKEN;
         }
-        if (Blind)
-            feel_location(x, y); /* we know we broke it */
-        else
-            newsym(x, y);
+        feel_newsym(x, y); /* we know we broke it */
         unblock_point(x, y); /* vision */
         if (shopdoor) {
             add_damage(x, y, 400L);
index db9a57995f6e81b334d63cd3d8d9dc9fb87977f9..0f6ab0f71ce203e77c2138bd69480021a1498558 100644 (file)
@@ -648,10 +648,7 @@ int x, y;
                 add_damage(cc.x, cc.y, 0L);
         } else
             door->doormask = D_ISOPEN;
-        if (Blind)
-            feel_location(cc.x, cc.y); /* the hero knows she opened it  */
-        else
-            newsym(cc.x, cc.y);
+        feel_newsym(cc.x, cc.y); /* the hero knows she opened it */
         unblock_point(cc.x, cc.y); /* vision: new see through there */
     } else {
         exercise(A_STR, TRUE);
@@ -781,10 +778,7 @@ doclose()
             || rn2(25) < (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 3) {
             pline_The("door closes.");
             door->doormask = D_CLOSED;
-            if (Blind)
-                feel_location(x, y); /* the hero knows she closed it */
-            else
-                newsym(x, y);
+            feel_newsym(x, y); /* the hero knows she closed it */
             block_point(x, y); /* vision:  no longer see there */
         } else {
             exercise(A_STR, TRUE);
index ebc1eede176aac71154f18c95ad640c464b68a98..3bef3ccaec711c43e53708df0d8d8f081dd58251 100644 (file)
@@ -760,10 +760,7 @@ boolean shatter;
         otmp = nxtobj(otmp, STATUE, TRUE);
     }
 
-    if (Blind)
-        feel_location(x, y);
-    else
-        newsym(x, y);
+    feel_newsym(x, y);
     return mtmp;
 }