comparison xrogue/chase.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
comparison
equal deleted inserted replaced
303:e06ebc407615 304:e52a8a7ad4c5
60 */ 60 */
61 if (x<0 || x >= cols || index == 4) continue; 61 if (x<0 || x >= cols || index == 4) continue;
62 62
63 /* Is it OK to move there? */ 63 /* Is it OK to move there? */
64 if (step_ok(y, x, NOMONST, tp) && 64 if (step_ok(y, x, NOMONST, tp) &&
65 (!isatrap(mvwinch(cw, y, x)) || 65 (!isatrap(mvwinch(cw, y, x) & A_CHARTEXT) ||
66 rnd(10) >= tp->t_stats.s_intel || 66 rnd(10) >= tp->t_stats.s_intel ||
67 on(*tp, ISFLY))) { 67 on(*tp, ISFLY))) {
68 /* OK, we can go here. But don't go there if 68 /* OK, we can go here. But don't go there if
69 * monster can't get at player from there 69 * monster can't get at player from there
70 */ 70 */
90 90
91 /* Move the monster from the old space */ 91 /* Move the monster from the old space */
92 mvwaddch(cw, tp->t_pos.y, tp->t_pos.x, tp->t_oldch); 92 mvwaddch(cw, tp->t_pos.y, tp->t_pos.x, tp->t_oldch);
93 93
94 /* Move it to the new space */ 94 /* Move it to the new space */
95 tp->t_oldch = mvwinch(cw, y, x); 95 tp->t_oldch = mvwinch(cw, y, x) & A_CHARTEXT;
96 96
97 /* Display the creature if our hero can see it */ 97 /* Display the creature if our hero can see it */
98 if (cansee(y, x) && 98 if (cansee(y, x) &&
99 off(*tp, ISINWALL) && 99 off(*tp, ISINWALL) &&
100 !invisible(tp)) 100 !invisible(tp))
107 /* Record the new position */ 107 /* Record the new position */
108 tp->t_pos.y = y; 108 tp->t_pos.y = y;
109 tp->t_pos.x = x; 109 tp->t_pos.x = x;
110 110
111 /* If the monster is on a trap, trap it */ 111 /* If the monster is on a trap, trap it */
112 rch = mvinch(y, x); 112 rch = mvinch(y, x) & A_CHARTEXT;
113 if (isatrap(rch)) { 113 if (isatrap(rch)) {
114 if (cansee(y, x)) tp->t_oldch = rch; 114 if (cansee(y, x)) tp->t_oldch = rch;
115 be_trapped(tp, &(tp->t_pos)); 115 be_trapped(tp, &(tp->t_pos));
116 } 116 }
117 } 117 }
251 251
252 /* Is there a monster on this spot closer to our goal? 252 /* Is there a monster on this spot closer to our goal?
253 * Don't look in our spot or where we were. 253 * Don't look in our spot or where we were.
254 */ 254 */
255 if (!ce(tryp, *er) && !ce(tryp, tp->t_oldpos) && 255 if (!ce(tryp, *er) && !ce(tryp, tp->t_oldpos) &&
256 isalpha(mch = mvwinch(mw, y, x))) { 256 isalpha(mch = mvwinch(mw, y, x) & A_CHARTEXT)) {
257 int test_dist; 257 int test_dist;
258 258
259 test_dist = DISTANCE(y, x, ee->y, ee->x); 259 test_dist = DISTANCE(y, x, ee->y, ee->x);
260 if (test_dist <= 25 && /* Let's be fairly close */ 260 if (test_dist <= 25 && /* Let's be fairly close */
261 test_dist < monst_dist) { 261 test_dist < monst_dist) {
267 } 267 }
268 268
269 /* Can we move onto the spot? */ 269 /* Can we move onto the spot? */
270 if (!diag_ok(er, &tryp, tp)) continue; 270 if (!diag_ok(er, &tryp, tp)) continue;
271 271
272 ch = mvwinch(cw, y, x); /* Screen character */ 272 ch = mvwinch(cw, y, x) & A_CHARTEXT; /* Screen character */
273 273
274 /* 274 /*
275 * Stepping on player is NOT okay if we are fleeing. 275 * Stepping on player is NOT okay if we are fleeing.
276 * If we are friendly to the player and there is a monster 276 * If we are friendly to the player and there is a monster
277 * in the way that is not of our race, it is okay to move 277 * in the way that is not of our race, it is okay to move
701 mvwaddch(cw, ch_ret.y, ch_ret.x, mvinch(ch_ret.y, ch_ret.x)); 701 mvwaddch(cw, ch_ret.y, ch_ret.x, mvinch(ch_ret.y, ch_ret.x));
702 updpack(TRUE, th); /* Update the monster's encumberance, too */ 702 updpack(TRUE, th); /* Update the monster's encumberance, too */
703 } 703 }
704 } 704 }
705 705
706 rch = mvwinch(stdscr, old_pos.y, old_pos.x); 706 rch = mvwinch(stdscr, old_pos.y, old_pos.x) & A_CHARTEXT;
707 if (th->t_oldch == floor && rch != floor && !isatrap(rch)) 707 if (th->t_oldch == floor && rch != floor && !isatrap(rch))
708 mvwaddch(cw, old_pos.y, old_pos.x, rch); 708 mvwaddch(cw, old_pos.y, old_pos.x, rch);
709 else 709 else
710 mvwaddch(cw, old_pos.y, old_pos.x, th->t_oldch); 710 mvwaddch(cw, old_pos.y, old_pos.x, th->t_oldch);
711 sch = mvwinch(cw, ch_ret.y, ch_ret.x); /* What player sees */ 711 sch = mvwinch(cw, ch_ret.y, ch_ret.x) & A_CHARTEXT; /* What player sees */
712 rch = mvwinch(stdscr, ch_ret.y, ch_ret.x); /* What's really there */ 712 rch = mvwinch(stdscr, ch_ret.y, ch_ret.x) & A_CHARTEXT; /* What's really there */
713 713
714 /* If we have a tunneling monster, it may be making a tunnel */ 714 /* If we have a tunneling monster, it may be making a tunnel */
715 if (on(*th, CANTUNNEL) && 715 if (on(*th, CANTUNNEL) &&
716 (rch==SECRETDOOR || rch==WALL || rch==VERTWALL || rch==HORZWALL)) { 716 (rch==SECRETDOOR || rch==WALL || rch==VERTWALL || rch==HORZWALL)) {
717 unsigned char nch; /* The new look to the tunnel */ 717 unsigned char nch; /* The new look to the tunnel */
797 797
798 /* Record monster's last position (if new one is different) */ 798 /* Record monster's last position (if new one is different) */
799 if (!ce(ch_ret, old_pos)) th->t_oldpos = old_pos; 799 if (!ce(ch_ret, old_pos)) th->t_oldpos = old_pos;
800 800
801 /* If the monster is on a trap, trap it */ 801 /* If the monster is on a trap, trap it */
802 sch = mvinch(ch_ret.y, ch_ret.x); 802 sch = mvinch(ch_ret.y, ch_ret.x) & A_CHARTEXT;
803 if (isatrap(sch)) { 803 if (isatrap(sch)) {
804 if (cansee(ch_ret.y, ch_ret.x)) th->t_oldch = sch; 804 if (cansee(ch_ret.y, ch_ret.x)) th->t_oldch = sch;
805 be_trapped(th, &ch_ret); 805 be_trapped(th, &ch_ret);
806 } 806 }
807 } 807 }
905 905
906 /* Make sure we have free area all the way to the player */ 906 /* Make sure we have free area all the way to the player */
907 ery += dy; 907 ery += dy;
908 erx += dx; 908 erx += dx;
909 while ((ery != eey) || (erx != eex)) { 909 while ((ery != eey) || (erx != eex)) {
910 switch (ch = winat(ery, erx)) { 910 switch (ch = winat(ery, erx) & A_CHARTEXT) {
911 case VERTWALL: 911 case VERTWALL:
912 case HORZWALL: 912 case HORZWALL:
913 case WALL: 913 case WALL:
914 case DOOR: 914 case DOOR:
915 case SECRETDOOR: 915 case SECRETDOOR: