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.
This commit is contained in:
John "Elwin" Edwards 2021-04-14 18:55:33 -04:00
parent 6f21b5b88a
commit 6c3cd116ff
122 changed files with 374 additions and 280 deletions

View file

@ -75,12 +75,10 @@ void
initarmor(struct object *obj, int what)
{
struct init_armor *iwa;
struct magic_item *mi;
obj->o_type = ARMOR;
obj->o_which = what;
iwa = &armors[what];
mi = &a_magic[what];
obj->o_vol = iwa->a_vol;
obj->o_ac = iwa->a_class;
obj->o_weight = iwa->a_wght;

View file

@ -210,7 +210,7 @@ do_chase(struct linked_list *mon)
}
if (pl_off(ISBLIND))
mvwaddch(cw,th->t_pos.y,th->t_pos.x,th->t_oldch);
sch = mvwinch(cw, ch_ret.y, ch_ret.x);
sch = mvwinch(cw, ch_ret.y, ch_ret.x) & A_CHARTEXT;
if (rer != NULL && rf_on(rer,ISDARK) && sch == FLOOR &&
DISTANCE(ch_ret.y,ch_ret.x,th->t_pos.y,th->t_pos.x) < 3 &&
pl_off(ISBLIND))
@ -452,7 +452,8 @@ diag_ok(struct coord *sp, struct coord *ep)
{
if (ep->x == sp->x || ep->y == sp->y)
return TRUE;
if (step_ok(mvinch(ep->y,sp->x)) && step_ok(mvinch(sp->y,ep->x)))
if (step_ok(mvinch(ep->y,sp->x) & A_CHARTEXT) &&
step_ok(mvinch(sp->y,ep->x) & A_CHARTEXT))
return TRUE;
return FALSE;
}

View file

@ -638,14 +638,10 @@ u_level(void)
void
shell(void)
{
reg int pid;
reg char *sh;
int ret_status;
/*
* Set the terminal back to original mode
*/
sh = getenv("SHELL");
wclear(hw);
wmove(hw, LINES-1, 0);
draw(hw);

View file

@ -30,7 +30,7 @@ displevl(void)
for (i = 0; i < LINES - 2; i++) {
for (j = 0; j < COLS - 1; j++) {
ch = mvinch(i,j);
ch = mvinch(i,j) & A_CHARTEXT;
if (isatrap(ch)) {
struct trap *what;
@ -60,7 +60,7 @@ displevl(void)
it->t_oldch = ch;
}
}
mch = mvwinch(cw, i, j);
mch = mvwinch(cw, i, j) & A_CHARTEXT;
if (isalpha(mch))
ch = mch;
mvwaddch(cw, i, j, ch);
@ -77,7 +77,7 @@ displevl(void)
void
dispmons(void)
{
reg int ch, y, x;
reg int y, x;
reg struct thing *it;
reg struct linked_list *item;
@ -103,7 +103,7 @@ winat(int y, int x)
reg char ch;
if (mvwinch(mw,y,x) == ' ')
ch = mvinch(y, x); /* non-monsters */
ch = mvinch(y, x) & A_CHARTEXT; /* non-monsters */
else
ch = winch(mw); /* monsters */
return ch;

View file

@ -122,7 +122,6 @@ void
init_colors(void)
{
reg int i, j;
reg char *str;
bool used[NCOLORS];
for (i = 0; i < NCOLORS; i++)
@ -185,7 +184,6 @@ void
init_stones(void)
{
reg int i, j;
reg char *str;
bool used[NSTONES];
for (i = 0; i < NSTONES; i++)

View file

@ -136,8 +136,6 @@ dead_end(char ch)
int
readchar(void)
{
char c;
fflush(stdout);
return( md_readchar(cw) );
}

View file

@ -133,7 +133,7 @@ look(bool wakeup)
mvaddch(y, x, FLOOR);
else {
tp = THINGPTR(it);
if (isatrap(tp->t_oldch = mvinch(y, x))) {
if (isatrap(tp->t_oldch = mvinch(y, x) & A_CHARTEXT)) {
struct trap *trp;
if ((trp = trap_at(y,x)) == NULL)

View file

@ -102,7 +102,7 @@ new_monster(char type, struct coord *cp, bool treas)
tp->t_indx = type;
tp->t_pos = *cp;
tp->t_room = roomin(cp);
tp->t_oldch = mvwinch(cw, cp->y, cp->x);
tp->t_oldch = mvwinch(cw, cp->y, cp->x) & A_CHARTEXT;
tp->t_nomove = 0;
tp->t_nocmd = 0;
mvwaddch(mw, cp->y, cp->x, tp->t_type);
@ -261,7 +261,7 @@ wake_monster(int y, int x)
* Hide invisible monsters
*/
if ((tp->t_flags & ISINVIS) && pl_off(CANSEE))
ch = mvinch(y, x);
ch = mvinch(y, x) & A_CHARTEXT;
/*
* Let greedy ones guard gold
*/
@ -284,7 +284,7 @@ genocide(void)
reg struct linked_list *ip, *nip;
reg struct thing *mp;
struct monster *mm;
reg int i, ii, c;
reg int i, c;
if (levcount == 0) {
mpos = 0;

View file

@ -203,7 +203,7 @@ do_move(int dy, int dx)
mvwaddch(cw, nh.y, nh.x, PLAYER);
hero = nh;
player.t_room = rp;
player.t_oldch = mvinch(hero.y, hero.x);
player.t_oldch = mvinch(hero.y, hero.x) & A_CHARTEXT;
}
/*
@ -263,13 +263,13 @@ light(struct coord *cp)
mit = THINGPTR(item);
if (mit->t_oldch == ' ')
if (!rf_on(rp,ISDARK))
mit->t_oldch = mvinch(y, x);
mit->t_oldch = mvinch(y, x) & A_CHARTEXT;
if (levtype == MAZELEV)
ch = mvinch(y, x);
ch = mvinch(y, x) & A_CHARTEXT;
}
}
if (rf_on(rp,ISDARK)) {
rch = mvwinch(cw, y, x);
rch = mvwinch(cw, y, x) & A_CHARTEXT;
if (isatrap(rch)) {
ch = rch; /* if its a trap */
}
@ -320,7 +320,7 @@ show(int y, int x)
if (ch == 's')
ch = ' '; /* shadows show as a blank */
else
ch = mvinch(y, x); /* hide invisibles */
ch = mvinch(y, x) & A_CHARTEXT; /* hide invisibles */
}
}
}
@ -336,7 +336,6 @@ be_trapped(struct coord *tc, struct thing *th)
{
reg struct trap *trp;
reg int ch, ishero;
struct linked_list *mon;
char stuckee[35], seeit, sayso;
if ((trp = trap_at(tc->y, tc->x)) == NULL)

View file

@ -26,7 +26,6 @@ void put_things(void);
void
new_level(int ltype)
{
register int i;
register char ch;
struct coord traploc;
struct room *rp;
@ -136,7 +135,7 @@ again:
} while(levtype==MAZELEV&&DISTANCE(hero.y,hero.x,stairs.y,stairs.x)<10);
player.t_room = rp;
player.t_oldch = mvinch(hero.y, hero.x);
player.t_oldch = mvinch(hero.y, hero.x) & A_CHARTEXT;
light(&hero);
mvwaddch(cw,hero.y,hero.x,PLAYER);
nochange = FALSE;

View file

@ -132,7 +132,7 @@ void
conn(int r1, int r2)
{
reg struct room *rpf, *rpt = NULL;
reg char rmt, direc;
reg signed char rmt, direc;
reg int distance, turn_spot, turn_distance, rm;
struct coord curr, turn_delta, spos, epos;

View file

@ -288,7 +288,7 @@ int
ring_eat(void)
{
reg struct object *lb;
reg int hand, i, howmuch;
reg int i, howmuch;
bool addit;
howmuch = 0;

View file

@ -288,9 +288,9 @@ showtop(int showname)
for (scp = top_ten; scp <= &top_ten[9]; scp++) {
if (scp->sc_score > 0) {
printf("%d\t%d\t%s: %s\t\t--> %s on level %d",
scp - top_ten + 1, scp->sc_score, scp->sc_name,
ctime(&scp->sc_date), reason[scp->sc_flags],
scp->sc_level);
(int) (scp - top_ten + 1), scp->sc_score,
scp->sc_name, ctime(&scp->sc_date),
reason[scp->sc_flags], scp->sc_level);
if (scp->sc_flags == KILLED) {
killer = killname(scp->sc_monster);
printf(" by a%s %s",vowelstr(killer), killer);

View file

@ -31,9 +31,7 @@ do_rooms(void)
bool treas = FALSE;
reg int i;
reg struct room *rp;
reg struct linked_list *item;
reg struct thing *tp;
struct coord top, bsze, mp;
struct coord top, bsze;
/*
* bsze is the maximum room size

View file

@ -55,7 +55,6 @@ ignore(void)
bool
save_game(void)
{
reg FILE *savef;
reg int c;
char buf[LINLEN];
@ -191,8 +190,6 @@ save_file(FILE *savef)
bool
restore(char *file, char **envp)
{
register int pid;
int ret_status;
#ifndef _AIX
extern char **environ;
#endif
@ -305,4 +302,5 @@ restore(char *file, char **envp)
restscr(cw);
md_srandom(md_random_seed());
playit();
return FALSE;
}

View file

@ -32,7 +32,6 @@ read_scroll(void)
reg int i, j, wh;
reg char ch, nch;
struct room *rp;
struct linked_list *titem;
char buf[LINLEN];
bool bless, curse;
@ -161,7 +160,7 @@ read_scroll(void)
overwrite(stdscr, hw);
for (i = 1; i < LINES - 2; i++) {
for (j = 0; j < COLS; j++) {
switch (nch = ch = mvwinch(hw, i, j)) {
switch (nch = ch = mvwinch(hw, i, j) & A_CHARTEXT) {
case SECRETDOOR:
nch = DOOR;
mvaddch(i, j, nch);

View file

@ -832,7 +832,6 @@ rs_read_string_index(FILE *inf, char *master[], int maxindex, char **str)
int
rs_read_strings(FILE *inf, char **s, int count, int max)
{
int len = 0;
int n = 0;
int value = 0;
@ -2243,7 +2242,9 @@ rs_save_file(FILE *savef)
int
rs_restore_file(FILE *inf)
{
#ifndef WIZARD
bool junk;
#endif
int endian = 0x01020304;
big_endian = ( *((char *)&endian) == 0x01 );

View file

@ -219,7 +219,7 @@ do_zap(bool gotdir)
y += delta.y;
x += delta.x;
} while (step_ok(winat(y, x)));
if (isalpha(monster = mvwinch(mw, y, x))) {
if (isalpha(monster = mvwinch(mw, y, x) & A_CHARTEXT)) {
int omonst;
if (wh != WS_MINVIS)
@ -271,7 +271,7 @@ do_zap(bool gotdir)
tp->t_flags |= ISRUN;
mvwaddch(mw, y, x, ' ');
mvwaddch(mw, tp->t_pos.y, tp->t_pos.x, monster);
tp->t_oldch = mvwinch(cw,tp->t_pos.y,tp->t_pos.x);
tp->t_oldch = mvwinch(cw,tp->t_pos.y,tp->t_pos.x) & A_CHARTEXT;
}
}
}

View file

@ -223,7 +223,7 @@ drop(struct linked_list *item)
reg struct object *op;
if (item == NULL) {
ch = mvinch(hero.y, hero.x);
ch = mvinch(hero.y, hero.x) & A_CHARTEXT;
if (ch != FLOOR && ch != PASSAGE && ch != POOL) {
msg("There is something there already.");
after = FALSE;

View file

@ -299,7 +299,6 @@ trans_line(void)
void
do_maze(void)
{
struct coord tp;
reg int i, least;
reg struct room *rp;
bool treas;
@ -485,7 +484,7 @@ rmwall(int newy, int newx, int oldy, int oldx)
void
crankout(void)
{
reg int x, y, i;
reg int x, y;
for (y = 0; y < LINES - 3; y++) {
move(y + 1, 0);

View file

@ -141,10 +141,12 @@ fall(struct linked_list *item, bool pr)
}
if (pr)
if (obj->o_type == WEAPON) /* BUGFIX: Identification trick */
msg("Your %s vanishes as it hits the ground.", w_magic[obj->o_which].mi_name);
else
msg("%s vanishes as it hits the ground.", inv_name(obj,TRUE));
{
if (obj->o_type == WEAPON) /* BUGFIX: Identification trick */
msg("Your %s vanishes as it hits the ground.", w_magic[obj->o_which].mi_name);
else
msg("%s vanishes as it hits the ground.", inv_name(obj,TRUE));
}
discard(item);
}

View file

@ -319,7 +319,7 @@ teleport(struct coord spot, struct thing *th)
th->t_pos = spot;
rm = rp - &rooms[0];
th->t_room = rp;
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;
if (ishero)
light(&oldspot);
th->t_nomove = 0;