diff xrogue/move.c @ 304:e52a8a7ad4c5

Fix many compiler warnings. There should only be two changes in behavior: arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly applied to characters who are not monks instead of monks who are not empty-handed. urogue/fight.c: fixed an interaction with the "debug" macro that could cause the wrong message to be displayed.
author John "Elwin" Edwards
date Wed, 14 Apr 2021 18:55:33 -0400
parents f54901b9c39b
children
line wrap: on
line diff
--- a/xrogue/move.c	Sat Mar 20 22:36:52 2021 -0400
+++ b/xrogue/move.c	Wed Apr 14 18:55:33 2021 -0400
@@ -319,7 +319,7 @@
 
                 /* Put it there */
                 mvwaddch(mw, th->t_pos.y, th->t_pos.x, th->t_type);
-                th->t_oldch = mvwinch(cw, th->t_pos.y, th->t_pos.x);
+                th->t_oldch = mvwinch(cw, th->t_pos.y, th->t_pos.x) & A_CHARTEXT;
                 /*
                  * check to see if room that creature appears in should
                  * light up
@@ -885,7 +885,7 @@
     }
     if (running && ce(hero, move_nh))
         after = running = FALSE;
-    ch = winat(move_nh.y, move_nh.x);
+    ch = winat(move_nh.y, move_nh.x) & A_CHARTEXT;
 
     /* Take care of hero trying to move close to something frightening */
     if (on(player, ISFLEE)) {
@@ -969,7 +969,7 @@
         /* Did we succeed? */
         if (ce(tp->t_pos, current)) {
             /* Reset our idea of what ch is */
-            ch = winat(move_nh.y, move_nh.x);
+            ch = winat(move_nh.y, move_nh.x) & A_CHARTEXT;
 
             /* Let it be known that we made the switch */
             changed = TRUE;
@@ -1140,22 +1140,22 @@
                 case 'h':
                 case 'l':
                     if (old_hero.y + 1 < lines - 2) {
-                        wall_check = winat(old_hero.y + 1, old_hero.x);
+                        wall_check = winat(old_hero.y + 1, old_hero.x) & A_CHARTEXT;
                         if (!isrock(wall_check)) call_light = TRUE;
                     }
                     if (old_hero.y - 1 > 0) {
-                        wall_check = winat(old_hero.y - 1, old_hero.x);
+                        wall_check = winat(old_hero.y - 1, old_hero.x) & A_CHARTEXT;
                         if (!isrock(wall_check)) call_light = TRUE;
                     }
                     break;
                 case 'j':
                 case 'k':
                     if (old_hero.x + 1 < cols) {
-                        wall_check = winat(old_hero.y, old_hero.x + 1);
+                        wall_check = winat(old_hero.y, old_hero.x + 1) & A_CHARTEXT;
                         if (!isrock(wall_check)) call_light = TRUE;
                     }
                     if (old_hero.x - 1 >= 0) {
-                        wall_check = winat(old_hero.y, old_hero.x - 1);
+                        wall_check = winat(old_hero.y, old_hero.x - 1) & A_CHARTEXT;
                         if (!isrock(wall_check)) call_light = TRUE;
                     }
                     break;
@@ -1177,7 +1177,7 @@
         if (rp->r_flags & ISTREAS)
             wake_room(rp);
     }
-    ch = winat(old_hero.y, old_hero.x);
+    ch = winat(old_hero.y, old_hero.x) & A_CHARTEXT;
     wmove(cw, unc(old_hero));
     waddch(cw, ch);
     wmove(cw, unc(hero));
@@ -1272,9 +1272,9 @@
 
             /* If we are looking at the hero in a rock, broaden our sights */
             if (&hero == cp || &player.t_oldpos == cp) {
-                ch = winat(hero.y, hero.x);
+                ch = winat(hero.y, hero.x) & A_CHARTEXT;
                 if (isrock(ch)) see_radius = 2;
-                ch = winat(player.t_oldpos.y, player.t_oldpos.x);
+                ch = winat(player.t_oldpos.y, player.t_oldpos.x) & A_CHARTEXT;
                 if (isrock(ch)) see_radius = 2;
             }
 
@@ -1347,7 +1347,7 @@
 
                     /* Previously not seen -- now can see it */
                     if (tp->t_oldch == ' ' && cansee(tp->t_pos.y, tp->t_pos.x)) 
-                        tp->t_oldch = mvinch(y, x);
+                        tp->t_oldch = mvinch(y, x) & A_CHARTEXT;
 
                     /* Previously seen -- now can't see it */
                     else if (!cansee(tp->t_pos.y, tp->t_pos.x) &&
@@ -1379,8 +1379,8 @@
                     on(player, ISBLIND)         ||
                     (rp->r_flags & FORCEDARK)   ||
                     (levtype == MAZELEV && !see_here && see_before)) {
-                    sch = mvwinch(cw, y, x);    /* What's seen */
-                    rch = mvinch(y, x); /* What's really there */
+                    sch = mvwinch(cw, y, x) & A_CHARTEXT;    /* What's seen */
+                    rch = mvinch(y, x) & A_CHARTEXT; /* What's really there */
                     switch (rch) {
                         case DOOR:
                         case SECRETDOOR:
@@ -1598,7 +1598,7 @@
         return;
     }
     can_traps:
-    switch (och = mvinch(y, x)) {
+    switch (och = mvinch(y, x) & A_CHARTEXT) {
         case WALL:
         case FLOOR:
         case PASSAGE:
@@ -1775,7 +1775,7 @@
 char
 show(int y, int x)
 {
-    register unsigned char ch = winat(y, x);
+    register unsigned char ch = winat(y, x) & A_CHARTEXT;
     register struct linked_list *it;
     register struct thing *tp;
 
@@ -1787,7 +1787,7 @@
     else if (isalpha(ch)) {
         if ((it = find_mons(y, x)) == NULL) {
             msg("Show:  Can't find monster in show (%d, %d)", y, x);
-            return(mvwinch(stdscr, y, x));
+            return(mvwinch(stdscr, y, x) & A_CHARTEXT);
         }
         tp = THINGPTR(it);
 
@@ -1797,7 +1797,7 @@
         else if (invisible(tp)) {
             /* We can't see surprise-type creatures through "see invisible" */
             if (off(player,CANSEE) || on(*tp,CANSURPRISE))
-                ch = mvwinch(stdscr, y, x); /* Invisible */
+                ch = mvwinch(stdscr, y, x) & A_CHARTEXT; /* Invisible */
         }
         else if (on(*tp, CANINWALL)) {
             if (isrock(mvwinch(stdscr, y, x))) ch = winch(stdscr); /* As Xorn */