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

@ -65,7 +65,7 @@ can_blink(struct thing *tp)
/* Is it OK to move there? */
if (step_ok(y, x, NOMONST, tp) &&
(!isatrap(mvwinch(cw, y, x)) ||
(!isatrap(CCHAR( mvwinch(cw, y, x) )) ||
rnd(10) >= tp->t_stats.s_intel ||
on(*tp, ISFLY))) {
/* OK, we can go here. But don't go there if

View file

@ -921,7 +921,7 @@ call(bool mark)
}
else know = (bool *) 0;
}
if ((obj->o_flags & ISPOST) || (know && know[obj->o_which]) && !mark) {
if ((obj->o_flags & ISPOST) || (know && know[obj->o_which] && !mark)) {
msg("That has already been identified.");
return;
}

View file

@ -50,9 +50,11 @@ int
main(int argc, char *argv[], char *envp[])
{
register char *env;
#ifndef SCOREFILE
char *roguedir;
roguedir = md_getroguedir();
#endif
md_init();
/*

View file

@ -112,7 +112,9 @@ md_init(void)
# define SE exit_standout_mode
#endif
#ifdef _WIN32
static int md_standout_mode = 0;
#endif
void
md_raw_standout(void)
@ -292,7 +294,9 @@ md_gethomedir(void)
#endif
if ( (h == NULL) || (*h == '\0') )
{
if ( (h = getenv("HOME")) == NULL )
{
if ( (h = getenv("HOMEDRIVE")) == NULL)
h = "";
else
@ -303,6 +307,8 @@ md_gethomedir(void)
if ( (h = getenv("HOMEPATH")) == NULL)
h = "";
}
}
}
len = strlen(homedir);
@ -375,7 +381,7 @@ md_shellescape(void)
*/
setuid(getuid());
setgid(getgid());
execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0);
execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", (char *) NULL);
perror("No shelly");
_exit(-1);
}

View file

@ -447,10 +447,9 @@ use_mm(int which)
{
register struct object *obj = NULL;
register struct linked_list *item = NULL;
bool cursed, blessed, is_mm;
bool is_mm;
char buf[LINELEN];
cursed = FALSE;
is_mm = FALSE;
if (which < 0) { /* A real miscellaneous magic item */
@ -463,8 +462,6 @@ use_mm(int which)
return;
obj = OBJPTR(item);
cursed = (obj->o_flags & ISCURSED) != 0;
blessed = (obj->o_flags & ISBLESSED) != 0;
which = obj->o_which;
}

View file

@ -730,14 +730,12 @@ wake_monster(int y, int x)
register struct room *trp;
register const char *mname;
bool nasty; /* Will the monster "attack"? */
char ch;
if ((it = find_mons(y, x)) == NULL) {
msg("Can't find monster in show");
return (NULL);
}
tp = THINGPTR(it);
ch = tp->t_type;
trp = roomin(&tp->t_pos); /* Current room for monster */
mname = monsters[tp->t_index].m_name;

View file

@ -1339,7 +1339,7 @@ show(int y, int x)
else if (isalpha(ch)) {
if ((it = find_mons(y, x)) == NULL) {
msg("Can't find monster in show");
return(mvwinch(stdscr, y, x));
return(CCHAR( mvwinch(stdscr, y, x) ));
}
tp = THINGPTR(it);

View file

@ -267,6 +267,7 @@ get_str(char *opt, WINDOW *win)
continue;
}
else if (sp == buf)
{
if (c == '-' && win == hw) /* To move back a line in hw */
break;
else if (c == '~')
@ -276,6 +277,7 @@ get_str(char *opt, WINDOW *win)
sp += strlen(home);
continue;
}
}
*sp++ = c;
waddstr(win, unctrl(c));
}
@ -326,6 +328,7 @@ option(void)
{
waddstr(hw, op->o_prompt);
if ((retval = (*op->o_getfunc)(op->o_opt, hw)))
{
if (retval == QUIT)
break;
else if (op > optlist) { /* MINUS */
@ -338,6 +341,7 @@ option(void)
wmove(hw, 0, 0);
op--;
}
}
}
/*
* Switch back to original screen

View file

@ -139,7 +139,7 @@ void
conn(int r1, int r2)
{
register struct room *rpf, *rpt = NULL;
register char rmt;
register signed char rmt;
register int distance = 0, turn_spot = 0, turn_distance = 0;
register int rm;
register char direc;

View file

@ -522,7 +522,7 @@ steal(void)
if ((item = find_mons(new_pos.y, new_pos.x)) == NULL)
debug("Steal from what @ %d,%d?", new_pos.y, new_pos.x);
tp = THINGPTR(item);
if (isinvisible = invisible(tp)) mname = "creature";
if ( (isinvisible = invisible(tp)) ) mname = "creature";
else mname = monsters[tp->t_index].m_name;
/* Can player steal something unnoticed? */

View file

@ -511,7 +511,7 @@ score(unsigned long amount, int flags, short monst)
/* Make sure we have an in-bound reason */
if (scp->sc_flgs > REASONLEN) scp->sc_flgs = REASONLEN;
printf("%3d %10lu\t%s (%s)", scp - top_ten + 1,
printf("%3d %10lu\t%s (%s)", (int) (scp - top_ten + 1),
scp->sc_score, scp->sc_name, class);
if (prflags == REALLIFE) printf(" [in real life %.*s!%.*s]",

View file

@ -128,8 +128,6 @@ bool
save_file(FILE *savef)
{
int ret;
int slines = LINES;
int scols = COLS;
wmove(cw, LINES-1, 0);
draw(cw);

View file

@ -1318,7 +1318,7 @@ rs_write_sticks(FILE *savef)
int
rs_read_sticks(FILE *inf)
{
int i = 0, j = 0, list = 0;
int i = 0, list = 0;
if (read_error || format_error)
return(READSTAT);
@ -1645,7 +1645,7 @@ rs_write_room(FILE *savef, struct room *r)
int
rs_read_room(FILE *inf, struct room *r)
{
int value = 0, n = 0, i = 0, index = 0, id = 0;
int i = 0, index = 0;
struct linked_list *fires=NULL, *item = NULL;
if (read_error || format_error)

View file

@ -154,7 +154,7 @@ do_zap(bool gotdir, int which, int flag)
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x))) {
while (shoot_ok(CCHAR( winat(y, x) ))) {
y += delta.y;
x += delta.x;
}
@ -331,7 +331,7 @@ do_zap(bool gotdir, int which, int flag)
case WS_SLOW_M:
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x))) {
while (shoot_ok(CCHAR( winat(y, x) ))) {
y += delta.y;
x += delta.x;
}
@ -453,7 +453,7 @@ do_zap(bool gotdir, int which, int flag)
else {
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x)))
while (shoot_ok(CCHAR( winat(y, x) )))
{
y += delta.y;
x += delta.x;
@ -477,7 +477,7 @@ do_zap(bool gotdir, int which, int flag)
else {
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x)))
while (shoot_ok(CCHAR( winat(y, x) )))
{
y += delta.y;
x += delta.x;
@ -497,7 +497,7 @@ do_zap(bool gotdir, int which, int flag)
when WS_FEAR:
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x)))
while (shoot_ok(CCHAR( winat(y, x) )))
{
y += delta.y;
x += delta.x;
@ -530,7 +530,7 @@ do_zap(bool gotdir, int which, int flag)
when WS_MDEG:
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x)))
while (shoot_ok(CCHAR( winat(y, x) )))
{
y += delta.y;
x += delta.x;
@ -558,7 +558,7 @@ do_zap(bool gotdir, int which, int flag)
when WS_DISINTEGRATE:
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x))) {
while (shoot_ok(CCHAR( winat(y, x) ))) {
y += delta.y;
x += delta.x;
}

View file

@ -624,7 +624,7 @@ look(bool wakeup, bool runend)
*/
if (off(player, ISBLIND))
{
if (y == hero.y && x == hero.x
if ((y == hero.y && x == hero.x)
|| (inpass && (ch == '-' || ch == '|')))
continue;
@ -825,10 +825,12 @@ secretdoor(int y, int x)
cpp = &cp;
for (rp = rooms, i = 0; i < MAXROOMS; rp++, i++)
if (inroom(rp, cpp))
{
if (y == rp->r_pos.y || y == rp->r_pos.y + rp->r_max.y - 1)
return('-');
else
return('|');
}
return('p');
}

View file

@ -30,7 +30,8 @@ create_obj(bool prompt, int which_item, int which_type)
reg struct linked_list *item;
reg struct object *obj;
reg int wh;
reg char ch, newitem, newtype = 0, whc, msz, *pt;
reg char ch, newitem, newtype = 0, msz, *pt;
signed char whc;
WINDOW *thiswin;
thiswin = cw;

View file

@ -601,7 +601,7 @@ xcrypt(key, setting)
if ((*q++ = *key << 1))
key++;
}
if (des_setkey((unsigned char *) keybuf))
if (des_setkey((char *) keybuf))
return(NULL);
if (*setting == _PASSWORD_EFMT1) {
@ -620,7 +620,7 @@ xcrypt(key, setting)
/*
* Encrypt the key with itself.
*/
if (des_cipher((unsigned char*)keybuf, (unsigned char*)keybuf, 0, 1))
if (des_cipher((char*)keybuf, (char*)keybuf, 0, 1))
return(NULL);
/*
* And XOR with the next 8 characters of the key.
@ -630,7 +630,7 @@ xcrypt(key, setting)
*key)
*q++ ^= *key++ << 1;
if (des_setkey((unsigned char *) keybuf))
if (des_setkey((char *) keybuf))
return(NULL);
}
strncpy((char *)output, setting, 9);