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? */ /* Is it OK to move there? */
if (step_ok(y, x, NOMONST, tp) && 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 || rnd(10) >= tp->t_stats.s_intel ||
on(*tp, ISFLY))) { on(*tp, ISFLY))) {
/* OK, we can go here. But don't go there if /* OK, we can go here. But don't go there if

View file

@ -921,7 +921,7 @@ call(bool mark)
} }
else know = (bool *) 0; 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."); msg("That has already been identified.");
return; return;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -139,7 +139,7 @@ void
conn(int r1, int r2) conn(int r1, int r2)
{ {
register struct room *rpf, *rpt = NULL; 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 distance = 0, turn_spot = 0, turn_distance = 0;
register int rm; register int rm;
register char direc; register char direc;

View file

@ -522,7 +522,7 @@ steal(void)
if ((item = find_mons(new_pos.y, new_pos.x)) == NULL) if ((item = find_mons(new_pos.y, new_pos.x)) == NULL)
debug("Steal from what @ %d,%d?", new_pos.y, new_pos.x); debug("Steal from what @ %d,%d?", new_pos.y, new_pos.x);
tp = THINGPTR(item); tp = THINGPTR(item);
if (isinvisible = invisible(tp)) mname = "creature"; if ( (isinvisible = invisible(tp)) ) mname = "creature";
else mname = monsters[tp->t_index].m_name; else mname = monsters[tp->t_index].m_name;
/* Can player steal something unnoticed? */ /* 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 */ /* Make sure we have an in-bound reason */
if (scp->sc_flgs > REASONLEN) scp->sc_flgs = REASONLEN; 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); scp->sc_score, scp->sc_name, class);
if (prflags == REALLIFE) printf(" [in real life %.*s!%.*s]", if (prflags == REALLIFE) printf(" [in real life %.*s!%.*s]",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1032,12 +1032,9 @@ u_level(void)
void void
shell(void) shell(void)
{ {
register char *sh;
/* /*
* Set the terminal back to original mode * Set the terminal back to original mode
*/ */
sh = getenv("SHELL");
wclear(hw); wclear(hw);
wmove(hw, lines-1, 0); wmove(hw, lines-1, 0);
draw(hw); draw(hw);
@ -1138,7 +1135,7 @@ nameitem(struct linked_list *item, bool mark)
} }
else know = (bool *) 0; 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."); msg("That has already been identified.");
return; return;
} }

View file

@ -515,9 +515,11 @@ roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
} }
else if (att == &pstats) { /* Player attacks monster */ else if (att == &pstats) { /* Player attacks monster */
def_arm = def->s_arm - dext_prot(def->s_dext); def_arm = def->s_arm - dext_prot(def->s_dext);
if (player.t_ctype == C_MONK) /* no strength bonus for monk */ if (player.t_ctype == C_MONK) {
/* no strength bonus for monk */
if (weap == NULL) if (weap == NULL)
hplus += att->s_lvl/5; /* monks hplus varies with level */ hplus += att->s_lvl/5; /* monks hplus varies with level */
}
else else
hplus += str_plus(str_compute())+dext_plus(dex_compute()); hplus += str_plus(str_compute())+dext_plus(dex_compute());
} }

View file

@ -19,6 +19,7 @@
#include "curses.h" #include "curses.h"
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "rogue.h" #include "rogue.h"
#include "mach_dep.h" #include "mach_dep.h"
@ -293,12 +294,15 @@ init_names(void)
void void
init_player(void) init_player(void)
{ {
int stat_total, round, minimum, maximum, ch, i, j; int stat_total, round, minimum, maximum, ch, i;
short do_escape, *our_stats[NUMABILITIES-1]; short do_escape, *our_stats[NUMABILITIES-1];
#ifdef WIZARD
int j;
struct linked_list *weap_item, *armor_item; struct linked_list *weap_item, *armor_item;
struct object *obj; struct object *obj;
weap_item = armor_item = NULL; weap_item = armor_item = NULL;
#endif
if (char_type == -1) { if (char_type == -1) {
/* See what type character will be */ /* See what type character will be */

View file

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

View file

@ -843,9 +843,8 @@ use_mm(int which)
{ {
register struct object *obj = NULL; register struct object *obj = NULL;
register struct linked_list *item = NULL; register struct linked_list *item = NULL;
bool cursed, blessed, is_mm; bool is_mm;
cursed = FALSE;
is_mm = FALSE; is_mm = FALSE;
if (which < 0) { /* A real miscellaneous magic item */ if (which < 0) { /* A real miscellaneous magic item */
@ -878,8 +877,6 @@ use_mm(int which)
is_mm = TRUE; is_mm = TRUE;
obj = OBJPTR(item); obj = OBJPTR(item);
cursed = (obj->o_flags & ISCURSED) != 0;
blessed = (obj->o_flags & ISBLESSED) != 0;
which = obj->o_which; which = obj->o_which;
} }

View file

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

View file

@ -240,6 +240,7 @@ get_str(char *opt, WINDOW *win)
continue; continue;
} }
else if (sp == buf) else if (sp == buf)
{
if (c == '-' && win == hw) /* To move back a line in hw */ if (c == '-' && win == hw) /* To move back a line in hw */
break; break;
else if (c == '~') else if (c == '~')
@ -249,6 +250,7 @@ get_str(char *opt, WINDOW *win)
sp += strlen(home); sp += strlen(home);
continue; continue;
} }
}
*sp++ = c; *sp++ = c;
waddstr(win, unctrl(c)); waddstr(win, unctrl(c));
} }
@ -299,6 +301,7 @@ option(void)
{ {
waddstr(hw, op->o_prompt); waddstr(hw, op->o_prompt);
if ((retval = (*op->o_getfunc)(op->o_opt, hw))) if ((retval = (*op->o_getfunc)(op->o_opt, hw)))
{
if (retval == QUIT) if (retval == QUIT)
break; break;
else if (op > optlist) { /* MINUS */ else if (op > optlist) { /* MINUS */
@ -312,6 +315,7 @@ option(void)
op--; op--;
} }
} }
}
/* /*
* Switch back to original screen * Switch back to original screen
*/ */

View file

@ -143,7 +143,7 @@ void
conn(int r1, int r2) conn(int r1, int r2)
{ {
register struct room *rpf, *rpt = NULL; register struct room *rpf, *rpt = NULL;
register char rmt; register signed char rmt;
register int distance, max_diag, offset, i; register int distance, max_diag, offset, i;
register int rm; register int rm;
int turns[3], turn_dist[3]; int turns[3], turn_dist[3];

View file

@ -500,7 +500,7 @@ steal(void)
msg ("You can't steal from stone!"); msg ("You can't steal from stone!");
return; return;
} }
if (isinvisible = invisible(tp)) mname = "creature"; if ( (isinvisible = invisible(tp)) ) mname = "creature";
else mname = monster_name(tp); else mname = monster_name(tp);
/* Can player steal something unnoticed? */ /* Can player steal something unnoticed? */

View file

@ -580,7 +580,7 @@ score(unsigned long amount, int flags, short monst)
/* Make sure we have an in-bound reason */ /* Make sure we have an in-bound reason */
if (scp->sc_flags > REASONLEN) scp->sc_flags = REASONLEN; if (scp->sc_flags > REASONLEN) scp->sc_flags = 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); scp->sc_score, scp->sc_name, class);
if (prflags == REALLIFE) printf(" [in real life %.*s!%.*s]", if (prflags == REALLIFE) printf(" [in real life %.*s!%.*s]",

View file

@ -32,9 +32,6 @@ genocide(void)
register struct linked_list *ip; register struct linked_list *ip;
register struct thing *mp; register struct thing *mp;
register struct linked_list *nip; register struct linked_list *nip;
register int num_monst = NUMMONST-NUMUNIQUE-1, /* cannot genocide uniques */
pres_monst=1,
num_lines=2*(lines-3);
register int which_monst; register int which_monst;
which_monst = makemonster(FALSE, "Genocide", "wipe out"); which_monst = makemonster(FALSE, "Genocide", "wipe out");

View file

@ -1366,7 +1366,7 @@ rs_write_sticks(FILE *savef)
int int
rs_read_sticks(FILE *inf) rs_read_sticks(FILE *inf)
{ {
int i = 0, j = 0, list = 0; int i = 0, list = 0;
if (read_error || format_error) if (read_error || format_error)
return(READSTAT); return(READSTAT);
@ -1776,7 +1776,7 @@ rs_write_room(FILE *savef, struct room *r)
int int
rs_read_room(FILE *inf, struct room *r) 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; struct linked_list *fires=NULL, *item = NULL;
if (read_error || format_error) if (read_error || format_error)

View file

@ -91,7 +91,8 @@ do_zap(struct thing *zapper, struct object *obj, coord *direction, int which,
y += direction->y; y += direction->y;
x += direction->x; x += direction->x;
} }
while (shoot_ok(winat(y, x)) && !(y == hero.y && x == hero.x)); while (shoot_ok(CCHAR( winat(y, x)) ) &&
!(y == hero.y && x == hero.x));
if (y == hero.y && x == hero.x) if (y == hero.y && x == hero.x)
is_player = TRUE; is_player = TRUE;

View file

@ -583,7 +583,7 @@ get_dir(coord *direction)
else if (on(player, ISFLEE)) { else if (on(player, ISFLEE)) {
y = hero.y; y = hero.y;
x = hero.x; x = hero.x;
while (shoot_ok(winat(y, x))) { while (shoot_ok(CCHAR( winat(y, x) ))) {
y += direction->y; y += direction->y;
x += direction->x; x += direction->x;
} }
@ -821,7 +821,7 @@ look(bool wakeup, bool runend)
*/ */
if (off(player, ISBLIND)) if (off(player, ISBLIND))
{ {
if (y == hero.y && x == hero.x if ((y == hero.y && x == hero.x)
|| (inpass && (ch == '-' || ch == '|'))) || (inpass && (ch == '-' || ch == '|')))
continue; continue;
@ -1150,10 +1150,12 @@ secretdoor(int y, int x)
cpp = &cp; cpp = &cp;
for (rp = rooms, i = 0; i < MAXROOMS; rp++, i++) for (rp = rooms, i = 0; i < MAXROOMS; rp++, i++)
if (inroom(rp, cpp)) if (inroom(rp, cpp))
{
if (y == rp->r_pos.y || y == rp->r_pos.y + rp->r_max.y - 1) if (y == rp->r_pos.y || y == rp->r_pos.y + rp->r_max.y - 1)
return('-'); return('-');
else else
return('|'); return('|');
}
return('p'); return('p');
} }

View file

@ -38,7 +38,8 @@ create_obj(bool prompt, int which_item, int which_type)
reg struct linked_list *item; reg struct linked_list *item;
reg struct object *obj; reg struct object *obj;
reg int wh; reg int wh;
reg char ch, newitem, newtype, whc, msz, *pt; reg char ch, newitem, newtype, msz, *pt;
signed char whc;
WINDOW *thiswin; WINDOW *thiswin;
thiswin = cw; thiswin = cw;
@ -128,6 +129,7 @@ create_obj(bool prompt, int which_item, int which_type)
} }
if(msz == 1) { /* if only one type of item */ if(msz == 1) { /* if only one type of item */
ch = 'a'; ch = 'a';
newtype = 0;
} }
else if (prompt) { else if (prompt) {
register struct magic_item *wmi; register struct magic_item *wmi;

View file

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

View file

@ -203,7 +203,7 @@ command()
} }
else else
{ {
if (wizard = passwd()) if ( (wizard = passwd()) )
{ {
msg("You are suddenly as smart as Ken Arnold in dungeon #%d", dnum); msg("You are suddenly as smart as Ken Arnold in dungeon #%d", dnum);
wizard = TRUE; wizard = TRUE;

View file

@ -158,6 +158,7 @@ attack(struct thing *mp)
* Ants have poisonous bites * Ants have poisonous bites
*/ */
if (!save(VS_POISON)) if (!save(VS_POISON))
{
if (!ISWEARING(R_SUSTSTR)) if (!ISWEARING(R_SUSTSTR))
{ {
chg_str(-1); chg_str(-1);
@ -167,10 +168,13 @@ attack(struct thing *mp)
msg("A sting has weakened you"); msg("A sting has weakened you");
} }
else else
{
if (!terse) if (!terse)
msg("A sting momentarily weakens you"); msg("A sting momentarily weakens you");
else else
msg("Sting has no effect"); msg("Sting has no effect");
}
}
when 'W': when 'W':
/* /*
* Wraiths might drain energy levels * Wraiths might drain energy levels

View file

@ -261,13 +261,13 @@ char *metal[] = {
int cNMETAL = NMETAL; int cNMETAL = NMETAL;
struct magic_item things[NUMTHINGS] = { struct magic_item things[NUMTHINGS] = {
{ "", 27 }, /* potion */ { "", 27, 0 }, /* potion */
{ "", 27 }, /* scroll */ { "", 27, 0 }, /* scroll */
{ "", 18 }, /* food */ { "", 18, 0 }, /* food */
{ "", 9 }, /* weapon */ { "", 9, 0 }, /* weapon */
{ "", 9 }, /* armor */ { "", 9, 0 }, /* armor */
{ "", 5 }, /* ring */ { "", 5, 0 }, /* ring */
{ "", 5 }, /* stick */ { "", 5, 0 }, /* stick */
}; };
struct magic_item s_magic[MAXSCROLLS] = { struct magic_item s_magic[MAXSCROLLS] = {

View file

@ -419,9 +419,9 @@ playit()
int int
too_much() too_much()
{ {
#ifdef MAXLOAD
double avec[3]; double avec[3];
#ifdef MAXLOAD
if (md_loadav(avec) == 0) if (md_loadav(avec) == 0)
return (avec[2] > (MAXLOAD / 10.0)); return (avec[2] > (MAXLOAD / 10.0));
#endif #endif

View file

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

View file

@ -244,6 +244,7 @@ get_str(void *vopt, WINDOW *win)
continue; continue;
} }
else if (sp == buf) else if (sp == buf)
{
if (c == '-') if (c == '-')
break; break;
else if (c == '~') else if (c == '~')
@ -253,6 +254,7 @@ get_str(void *vopt, WINDOW *win)
sp += strlen(home); sp += strlen(home);
continue; continue;
} }
}
if ((sp - buf) < 78) /* Avoid overflow */ if ((sp - buf) < 78) /* Avoid overflow */
{ {

View file

@ -79,6 +79,7 @@ add_pack(struct linked_list *item, int silent)
* Check for and deal with scare monster scrolls * Check for and deal with scare monster scrolls
*/ */
if (obj->o_type == SCROLL && obj->o_which == S_SCARE) if (obj->o_type == SCROLL && obj->o_which == S_SCARE)
{
if (obj->o_flags & ISFOUND) if (obj->o_flags & ISFOUND)
{ {
msg("The scroll turns to dust as you pick it up."); msg("The scroll turns to dust as you pick it up.");
@ -88,6 +89,7 @@ add_pack(struct linked_list *item, int silent)
} }
else else
obj->o_flags |= ISFOUND; obj->o_flags |= ISFOUND;
}
inpack++; inpack++;
if (from_floor) if (from_floor)

View file

@ -206,7 +206,10 @@ conn(int r1, int r2)
turn_spot = rnd(distance-1) + 1; turn_spot = rnd(distance-1) + 1;
} }
else else
{
fatal("error in connection tables"); fatal("error in connection tables");
return;
}
/* /*
* Draw in the doors on either side of the passage or just put #'s * Draw in the doors on either side of the passage or just put #'s
* if the rooms are gone. * if the rooms are gone.

View file

@ -192,10 +192,12 @@ score(int amount, int flags, int monst)
endwin(); endwin();
} }
if (wizard) if (wizard)
{
if (strcmp(prbuf, "names") == 0) if (strcmp(prbuf, "names") == 0)
prflags = 1; prflags = 1;
else if (strcmp(prbuf, "edit") == 0) else if (strcmp(prbuf, "edit") == 0)
prflags = 2; prflags = 2;
}
md_lockfile(outf); md_lockfile(outf);
@ -244,7 +246,7 @@ score(int amount, int flags, int monst)
printf("Top Ten Adventurers:\nRank\tScore\tName\n"); printf("Top Ten Adventurers:\nRank\tScore\tName\n");
for (scp = top_ten; scp <= &top_ten[9]; scp++) { for (scp = top_ten; scp <= &top_ten[9]; scp++) {
if (scp->sc_score) { if (scp->sc_score) {
printf("%d\t%d\t%s: %s on level %d", scp - top_ten + 1, printf("%d\t%d\t%s: %s on level %d", (int) (scp - top_ten + 1),
scp->sc_score, scp->sc_name, reason[scp->sc_flags], scp->sc_score, scp->sc_name, reason[scp->sc_flags],
scp->sc_level); scp->sc_level);
if (scp->sc_flags == 0) { if (scp->sc_flags == 0) {
@ -451,10 +453,12 @@ total_winner()
worth = r_magic[obj->o_which].mi_worth; worth = r_magic[obj->o_which].mi_worth;
if (obj->o_which == R_ADDSTR || obj->o_which == R_ADDDAM || if (obj->o_which == R_ADDSTR || obj->o_which == R_ADDDAM ||
obj->o_which == R_PROTECT || obj->o_which == R_ADDHIT) obj->o_which == R_PROTECT || obj->o_which == R_ADDHIT)
{
if (obj->o_ac > 0) if (obj->o_ac > 0)
worth += obj->o_ac * 20; worth += obj->o_ac * 20;
else else
worth = 50; worth = 50;
}
when STICK: when STICK:
obj->o_flags |= ISKNOW; obj->o_flags |= ISKNOW;
ws_know[obj->o_which] = TRUE; ws_know[obj->o_which] = TRUE;

View file

@ -64,12 +64,6 @@
#define RSID_COORDLIST 0XABCD0016 #define RSID_COORDLIST 0XABCD0016
#define RSID_ROOMS 0XABCD0017 #define RSID_ROOMS 0XABCD0017
#define READSTAT (format_error || read_error )
#define WRITESTAT (write_error)
static int read_error = FALSE;
static int write_error = FALSE;
static int format_error = FALSE;
static int endian = 0x01020304; static int endian = 0x01020304;
#define big_endian ( *((char *)&endian) == 0x01 ) #define big_endian ( *((char *)&endian) == 0x01 )

View file

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

View file

@ -153,7 +153,7 @@ over:
mvaddch(th->t_pos.y, th->t_pos.x, th->t_oldch); mvaddch(th->t_pos.y, th->t_pos.x, th->t_oldch);
if (!ce(ch_ret, th->t_pos)) if (!ce(ch_ret, th->t_pos))
{ {
sch = mvinch(ch_ret.y, ch_ret.x); sch = mvinch(ch_ret.y, ch_ret.x) & A_CHARTEXT;
if (sch == FLOOR && (th->t_room->r_flags & ISDARK) if (sch == FLOOR && (th->t_room->r_flags & ISDARK)
&& DISTANCE(th->t_pos.y, th->t_pos.x, hero.y, hero.x) && DISTANCE(th->t_pos.y, th->t_pos.x, hero.y, hero.x)
&& !on(player, ISBLIND)) && !on(player, ISBLIND))

View file

@ -249,7 +249,7 @@ command(void)
} }
else else
{ {
if (wizard = passwd()) if ( (wizard = passwd()) )
{ {
noscore = TRUE; noscore = TRUE;
turn_see(FALSE); turn_see(FALSE);

View file

@ -59,9 +59,9 @@ void tstp(), endit(int);
long lseek(); long lseek();
extern coord ch_ret; extern coord ch_ret;
extern shint countch; extern char countch;
extern shint direction; extern char direction;
extern shint newcount; extern char newcount;
extern int between; extern int between;
extern int num_checks; extern int num_checks;
extern char lvl_mons[27]; extern char lvl_mons[27];
@ -83,6 +83,7 @@ extern FILE *md_fdopen(int fd, char *mode);
extern int md_fileno(FILE *fp); extern int md_fileno(FILE *fp);
extern char *md_getusername(int uid); extern char *md_getusername(int uid);
extern char *md_gethomedir(); extern char *md_gethomedir();
extern char *md_getpass(char *prompt);
extern int md_getuid(void); extern int md_getuid(void);
extern void md_ignore_signals(void); extern void md_ignore_signals(void);
extern void md_init(void); extern void md_init(void);

View file

@ -137,6 +137,7 @@ attack(THING *mp)
*/ */
if (cur_armor != NULL && cur_armor->o_ac < 9 if (cur_armor != NULL && cur_armor->o_ac < 9
&& cur_armor->o_which != LEATHER) && cur_armor->o_which != LEATHER)
{
if (ISWEARING(R_SUSTARM)) if (ISWEARING(R_SUSTARM))
msg("The rust vanishes instantly"); msg("The rust vanishes instantly");
else else
@ -147,6 +148,7 @@ attack(THING *mp)
else else
msg("your armor weakens"); msg("your armor weakens");
} }
}
when 'E': when 'E':
/* /*
* The gaze of the floating eye hypnotizes you * The gaze of the floating eye hypnotizes you
@ -167,6 +169,7 @@ attack(THING *mp)
* Ants have poisonous bites * Ants have poisonous bites
*/ */
if (!save(VS_POISON)) if (!save(VS_POISON))
{
if (!ISWEARING(R_SUSTSTR)) if (!ISWEARING(R_SUSTSTR))
{ {
chg_str(-1); chg_str(-1);
@ -176,10 +179,13 @@ attack(THING *mp)
msg("a sting has weakened you"); msg("a sting has weakened you");
} }
else else
{
if (!terse) if (!terse)
msg("a sting momentarily weakens you"); msg("a sting momentarily weakens you");
else else
msg("sting has no effect"); msg("sting has no effect");
}
}
when 'W': when 'W':
case 'V': case 'V':
/* /*

View file

@ -110,7 +110,9 @@ md_init(void)
#endif #endif
} }
#ifdef _WIN32
static int md_standout_mode = 0; static int md_standout_mode = 0;
#endif
void void
md_raw_standout(void) md_raw_standout(void)
@ -409,7 +411,7 @@ md_shellescape(void)
*/ */
setuid(getuid()); setuid(getuid());
setgid(getgid()); setgid(getgid());
execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0); execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", (char *) NULL);
perror("No shelly"); perror("No shelly");
_exit(-1); _exit(-1);
} }
@ -590,6 +592,7 @@ md_getloadavg(double *avg)
avg[0] = avg[1] = avg[2] = 0.0; avg[0] = avg[1] = avg[2] = 0.0;
return -1; return -1;
} }
return 3;
} }
long long

View file

@ -58,9 +58,7 @@ look(bool wakeup)
register int passcount = 0; register int passcount = 0;
register char pfl, *fp, pch; register char pfl, *fp, pch;
register int sy, sx, sumhero = 0, diffhero = 0; register int sy, sx, sumhero = 0, diffhero = 0;
register int oldx, oldy;
getyx(stdscr, oldy, oldx);
rp = proom; rp = proom;
if (!ce(oldpos, hero)) if (!ce(oldpos, hero))
{ {
@ -115,12 +113,15 @@ look(bool wakeup)
fp = &_flags[index]; fp = &_flags[index];
ch = _level[index]; ch = _level[index];
if (pch != DOOR && ch != DOOR) if (pch != DOOR && ch != DOOR)
{
if ((pfl & F_PASS) != (*fp & F_PASS)) if ((pfl & F_PASS) != (*fp & F_PASS))
continue; continue;
else if ((*fp & F_PASS) && (*fp & F_PNUM) != (pfl & F_PNUM)) else if ((*fp & F_PASS) && (*fp & F_PNUM) != (pfl & F_PNUM))
continue; continue;
}
if ((tp = _monst[index]) != NULL) if ((tp = _monst[index]) != NULL)
{
if (on(player, SEEMONST) && on(*tp, ISINVIS)) if (on(player, SEEMONST) && on(*tp, ISINVIS))
{ {
if (door_stop && !firstmove) if (door_stop && !firstmove)
@ -137,6 +138,7 @@ look(bool wakeup)
if (see_monst(tp)) if (see_monst(tp))
ch = tp->t_disguise; ch = tp->t_disguise;
} }
}
move(y, x); move(y, x);
if (ch != inch()) if (ch != inch())

View file

@ -75,7 +75,7 @@ new_monster(THING *tp, char type, coord *cp)
tp->t_type = type; tp->t_type = type;
tp->t_disguise = type; tp->t_disguise = type;
tp->t_pos = *cp; tp->t_pos = *cp;
tp->t_oldch = mvinch(cp->y, cp->x); tp->t_oldch = mvinch(cp->y, cp->x) & A_CHARTEXT;
tp->t_room = roomin(cp); tp->t_room = roomin(cp);
moat(cp->y, cp->x) = tp; moat(cp->y, cp->x) = tp;
mp = &monsters[tp->t_type-'A']; mp = &monsters[tp->t_type-'A'];

View file

@ -15,6 +15,7 @@
#include <curses.h> #include <curses.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include "rogue.h" #include "rogue.h"
#define EQSTR(a, b, c) (strncmp(a, b, c) == 0) #define EQSTR(a, b, c) (strncmp(a, b, c) == 0)

View file

@ -102,6 +102,7 @@ add_pack(THING *obj, bool silent)
* Check for and deal with scare monster scrolls * Check for and deal with scare monster scrolls
*/ */
if (obj->o_type == SCROLL && obj->o_which == S_SCARE) if (obj->o_type == SCROLL && obj->o_which == S_SCARE)
{
if (obj->o_flags & ISFOUND) if (obj->o_flags & ISFOUND)
{ {
detach(lvl_obj, obj); detach(lvl_obj, obj);
@ -112,6 +113,7 @@ add_pack(THING *obj, bool silent)
} }
else else
obj->o_flags |= ISFOUND; obj->o_flags |= ISFOUND;
}
inpack++; inpack++;
if (from_floor) if (from_floor)
@ -256,7 +258,7 @@ inventory(THING *list, int type)
void void
pick_up(char ch) pick_up(char ch)
{ {
register THING *obj, *mp; register THING *obj;
switch (ch) switch (ch)
{ {

View file

@ -99,10 +99,12 @@ score(int amount, int flags, char monst)
} }
#ifdef WIZARD #ifdef WIZARD
if (wizard) if (wizard)
{
if (strcmp(prbuf, "names") == 0) if (strcmp(prbuf, "names") == 0)
prflags = 1; prflags = 1;
else if (strcmp(prbuf, "edit") == 0) else if (strcmp(prbuf, "edit") == 0)
prflags = 2; prflags = 2;
}
#endif #endif
for(i=0; i<10; i++) for(i=0; i<10; i++)
{ {
@ -164,7 +166,7 @@ score(int amount, int flags, char monst)
for (scp = top_ten; scp <= &top_ten[9]; scp++) for (scp = top_ten; scp <= &top_ten[9]; scp++)
{ {
if (scp->sc_score) { if (scp->sc_score) {
printf("%d\t%d\t%s: %s on level %d", scp - top_ten + 1, printf("%d\t%d\t%s: %s on level %d", (int) (scp - top_ten + 1),
scp->sc_score, scp->sc_name, reason[scp->sc_flags], scp->sc_score, scp->sc_name, reason[scp->sc_flags],
scp->sc_level); scp->sc_level);
if (scp->sc_flags == 0) if (scp->sc_flags == 0)
@ -414,10 +416,12 @@ total_winner(void)
worth = r_magic[obj->o_which].mi_worth; worth = r_magic[obj->o_which].mi_worth;
if (obj->o_which == R_ADDSTR || obj->o_which == R_ADDDAM || if (obj->o_which == R_ADDSTR || obj->o_which == R_ADDDAM ||
obj->o_which == R_PROTECT || obj->o_which == R_ADDHIT) obj->o_which == R_PROTECT || obj->o_which == R_ADDHIT)
{
if (obj->o_ac > 0) if (obj->o_ac > 0)
worth += obj->o_ac * 100; worth += obj->o_ac * 100;
else else
worth = 10; worth = 10;
}
if (!(obj->o_flags & ISKNOW)) if (!(obj->o_flags & ISKNOW))
worth /= 2; worth /= 2;
obj->o_flags |= ISKNOW; obj->o_flags |= ISKNOW;

View file

@ -10,6 +10,10 @@
* See the file LICENSE.TXT for full copyright and licensing information. * See the file LICENSE.TXT for full copyright and licensing information.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
typedef struct { typedef struct {
const char *st_name; const char *st_name;
const int st_value; const int st_value;
@ -50,7 +54,7 @@ extern const char *metal[];
/* /*
* All the fun defines * All the fun defines
*/ */
#define shint char /* short integer (for very small #s) */ #define shint signed char /* short integer (for very small #s) */
#define when break;case #define when break;case
#define otherwise break;default #define otherwise break;default
#define until(expr) while(!(expr)) #define until(expr) while(!(expr))
@ -532,6 +536,9 @@ void fuse(void (*func)(), int arg, int time, int type);
void genocide(void); void genocide(void);
bool get_dir(void); bool get_dir(void);
THING *get_item(char *purpose, int type); THING *get_item(char *purpose, int type);
#ifdef WIZARD
int get_num(short *opt, WINDOW *win);
#endif
int get_str(char *opt, WINDOW *win); int get_str(char *opt, WINDOW *win);
void give_pack(THING *tp); void give_pack(THING *tp);
bool hit_monster(int y, int x, THING *obj); bool hit_monster(int y, int x, THING *obj);
@ -542,7 +549,7 @@ void init_names(void);
void init_player(void); void init_player(void);
void init_stones(void); void init_stones(void);
void init_things(void); void init_things(void);
void init_weapon(THING *weap, char type); void init_weapon(THING *weap, signed char type);
char *inv_name(THING *obj, bool drop); char *inv_name(THING *obj, bool drop);
bool inventory(THING *list, int type); bool inventory(THING *list, int type);
void invis_on(void); void invis_on(void);
@ -633,9 +640,6 @@ void whatis(bool insist);
void wield(void); void wield(void);
void writelog(int amount, int flags, char monst); void writelog(int amount, int flags, char monst);
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "extern.h" #include "extern.h"
#ifndef PATH_MAX #ifndef PATH_MAX

View file

@ -235,7 +235,7 @@ leave_room(coord *cp)
floor = ((rp->r_flags & ISDARK) && !on(player, ISBLIND)) ? ' ' : FLOOR; floor = ((rp->r_flags & ISDARK) && !on(player, ISBLIND)) ? ' ' : FLOOR;
for (y = rp->r_pos.y + 1; y < rp->r_max.y + rp->r_pos.y - 1; y++) for (y = rp->r_pos.y + 1; y < rp->r_max.y + rp->r_pos.y - 1; y++)
for (x = rp->r_pos.x + 1; x < rp->r_max.x + rp->r_pos.x - 1; x++) for (x = rp->r_pos.x + 1; x < rp->r_max.x + rp->r_pos.x - 1; x++)
switch (ch = mvinch(y, x)) switch (ch = mvinch(y, x) & A_CHARTEXT)
{ {
case ' ': case ' ':
case TRAP: case TRAP:
@ -251,6 +251,7 @@ leave_room(coord *cp)
* standout bit * standout bit
*/ */
if (isupper(toascii(ch))) if (isupper(toascii(ch)))
{
if (on(player, SEEMONST)) if (on(player, SEEMONST))
{ {
standout(); standout();
@ -270,6 +271,7 @@ leave_room(coord *cp)
msg("couldn't find monster in leave_room at (%d,%d)", y, x); msg("couldn't find monster in leave_room at (%d,%d)", y, x);
#endif #endif
} }
}
addch(floor); addch(floor);
} }

View file

@ -2078,7 +2078,9 @@ rs_save_file(FILE *savef)
int int
rs_restore_file(FILE *inf) rs_restore_file(FILE *inf)
{ {
#ifndef WIZARD
bool junk; bool junk;
#endif
THING *mitem; THING *mitem;
int endian = 0x01020304; int endian = 0x01020304;
big_endian = ( *((char *)&endian) == 0x01 ); big_endian = ( *((char *)&endian) == 0x01 );

View file

@ -159,7 +159,8 @@ do_zap(void)
rnd_pos(&rooms[rm], &tp->t_pos); rnd_pos(&rooms[rm], &tp->t_pos);
} until (winat(tp->t_pos.y, tp->t_pos.x) == FLOOR); } until (winat(tp->t_pos.y, tp->t_pos.x) == FLOOR);
tp->t_room = roomin(&tp->t_pos); tp->t_room = roomin(&tp->t_pos);
tp->t_oldch = mvinch(tp->t_pos.y, tp->t_pos.x); tp->t_oldch = mvinch(tp->t_pos.y, tp->t_pos.x) &
A_CHARTEXT;
if (see_monst(tp)) if (see_monst(tp))
mvaddch(tp->t_pos.y, tp->t_pos.x, tp->t_disguise); mvaddch(tp->t_pos.y, tp->t_pos.x, tp->t_disguise);
else if (on(player, SEEMONST)) else if (on(player, SEEMONST))
@ -175,7 +176,8 @@ do_zap(void)
tp->t_pos.x = hero.x + delta.x; tp->t_pos.x = hero.x + delta.x;
if (tp->t_pos.y != y || tp->t_pos.x != x) if (tp->t_pos.y != y || tp->t_pos.x != x)
tp->t_oldch = mvinch(tp->t_pos.y, tp->t_pos.x); tp->t_oldch = mvinch(tp->t_pos.y, tp->t_pos.x) &
A_CHARTEXT;
} }
moat(y, x) = NULL; moat(y, x) = NULL;
moat(tp->t_pos.y, tp->t_pos.x) = tp; moat(tp->t_pos.y, tp->t_pos.x) = tp;
@ -423,10 +425,12 @@ def:
if (!save(VS_MAGIC)) if (!save(VS_MAGIC))
{ {
if ((pstats.s_hpt -= roll(6, 6)) <= 0) if ((pstats.s_hpt -= roll(6, 6)) <= 0)
{
if (start == &hero) if (start == &hero)
death('b'); death('b');
else else
death(moat(start->y, start->x)->t_type); death(moat(start->y, start->x)->t_type);
}
used = TRUE; used = TRUE;
if (terse) if (terse)
msg("the %s hits", name); msg("the %s hits", name);

View file

@ -287,10 +287,12 @@ new_thing(void)
* the second one, then turn it into a identify scroll * the second one, then turn it into a identify scroll
*/ */
if (cur->o_which == S_GENOCIDE) if (cur->o_which == S_GENOCIDE)
{
if (got_genocide) if (got_genocide)
cur->o_which = S_IDENT; cur->o_which = S_IDENT;
else else
got_genocide = TRUE; got_genocide = TRUE;
}
when 2: when 2:
no_food = 0; no_food = 0;
cur->o_type = FOOD; cur->o_type = FOOD;

View file

@ -162,7 +162,7 @@ fall(THING *obj, bool pr)
* Set up the initial goodies for a weapon * Set up the initial goodies for a weapon
*/ */
void void
init_weapon(THING *weap, char type) init_weapon(THING *weap, signed char type)
{ {
register struct init_weps *iwp; register struct init_weps *iwp;

View file

@ -377,12 +377,15 @@ ucount(void)
} }
#endif #endif
#if defined(SCOREFILE) && defined(LOCKFILE)
static FILE *lfd = NULL;
#endif
/* /*
* lock_sc: * lock_sc:
* lock the score file. If it takes too long, ask the user if * lock the score file. If it takes too long, ask the user if
* they care to wait. Return TRUE if the lock is successful. * they care to wait. Return TRUE if the lock is successful.
*/ */
static FILE *lfd = NULL;
int int
lock_sc(void) lock_sc(void)
{ {

View file

@ -108,10 +108,12 @@ score(int amount, int flags, int monst)
#ifdef MASTER #ifdef MASTER
if (wizard) if (wizard)
{
if (strcmp(prbuf, "names") == 0) if (strcmp(prbuf, "names") == 0)
prflags = 1; prflags = 1;
else if (strcmp(prbuf, "edit") == 0) else if (strcmp(prbuf, "edit") == 0)
prflags = 2; prflags = 2;
}
#endif #endif
rd_score(top_ten); rd_score(top_ten);
/* /*

View file

@ -64,12 +64,6 @@
#define RSID_COORDLIST 0XABCD0016 #define RSID_COORDLIST 0XABCD0016
#define RSID_ROOMS 0XABCD0017 #define RSID_ROOMS 0XABCD0017
#define READSTAT (format_error || read_error )
#define WRITESTAT (write_error)
static int read_error = FALSE;
static int write_error = FALSE;
static int format_error = FALSE;
static int endian = 0x01020304; static int endian = 0x01020304;
#define big_endian ( *((char *)&endian) == 0x01 ) #define big_endian ( *((char *)&endian) == 0x01 )

View file

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

View file

@ -210,7 +210,7 @@ do_chase(struct linked_list *mon)
} }
if (pl_off(ISBLIND)) if (pl_off(ISBLIND))
mvwaddch(cw,th->t_pos.y,th->t_pos.x,th->t_oldch); 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 && 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 && DISTANCE(ch_ret.y,ch_ret.x,th->t_pos.y,th->t_pos.x) < 3 &&
pl_off(ISBLIND)) pl_off(ISBLIND))
@ -452,7 +452,8 @@ diag_ok(struct coord *sp, struct coord *ep)
{ {
if (ep->x == sp->x || ep->y == sp->y) if (ep->x == sp->x || ep->y == sp->y)
return TRUE; 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 TRUE;
return FALSE; return FALSE;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -133,7 +133,7 @@ look(bool wakeup)
mvaddch(y, x, FLOOR); mvaddch(y, x, FLOOR);
else { else {
tp = THINGPTR(it); tp = THINGPTR(it);
if (isatrap(tp->t_oldch = mvinch(y, x))) { if (isatrap(tp->t_oldch = mvinch(y, x) & A_CHARTEXT)) {
struct trap *trp; struct trap *trp;
if ((trp = trap_at(y,x)) == NULL) 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_indx = type;
tp->t_pos = *cp; tp->t_pos = *cp;
tp->t_room = roomin(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_nomove = 0;
tp->t_nocmd = 0; tp->t_nocmd = 0;
mvwaddch(mw, cp->y, cp->x, tp->t_type); mvwaddch(mw, cp->y, cp->x, tp->t_type);
@ -261,7 +261,7 @@ wake_monster(int y, int x)
* Hide invisible monsters * Hide invisible monsters
*/ */
if ((tp->t_flags & ISINVIS) && pl_off(CANSEE)) if ((tp->t_flags & ISINVIS) && pl_off(CANSEE))
ch = mvinch(y, x); ch = mvinch(y, x) & A_CHARTEXT;
/* /*
* Let greedy ones guard gold * Let greedy ones guard gold
*/ */
@ -284,7 +284,7 @@ genocide(void)
reg struct linked_list *ip, *nip; reg struct linked_list *ip, *nip;
reg struct thing *mp; reg struct thing *mp;
struct monster *mm; struct monster *mm;
reg int i, ii, c; reg int i, c;
if (levcount == 0) { if (levcount == 0) {
mpos = 0; mpos = 0;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -219,7 +219,7 @@ do_zap(bool gotdir)
y += delta.y; y += delta.y;
x += delta.x; x += delta.x;
} while (step_ok(winat(y, 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; int omonst;
if (wh != WS_MINVIS) if (wh != WS_MINVIS)
@ -271,7 +271,7 @@ do_zap(bool gotdir)
tp->t_flags |= ISRUN; tp->t_flags |= ISRUN;
mvwaddch(mw, y, x, ' '); mvwaddch(mw, y, x, ' ');
mvwaddch(mw, tp->t_pos.y, tp->t_pos.x, monster); 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; reg struct object *op;
if (item == NULL) { if (item == NULL) {
ch = mvinch(hero.y, hero.x); ch = mvinch(hero.y, hero.x) & A_CHARTEXT;
if (ch != FLOOR && ch != PASSAGE && ch != POOL) { if (ch != FLOOR && ch != PASSAGE && ch != POOL) {
msg("There is something there already."); msg("There is something there already.");
after = FALSE; after = FALSE;

View file

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

View file

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

View file

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

View file

@ -33,7 +33,9 @@ command(void)
static int fight_to_death; /* Flags if we are fighting to death */ static int fight_to_death; /* Flags if we are fighting to death */
static coord dir; /* Last direction specified */ static coord dir; /* Last direction specified */
#ifdef WIZARD
object *obj; object *obj;
#endif
char ch; char ch;
int ntimes = 1; /* Number of player moves */ int ntimes = 1; /* Number of player moves */
coord nullcoord; coord nullcoord;
@ -579,10 +581,12 @@ command(void)
* If he ran into something to take, let him pick it up. * If he ran into something to take, let him pick it up.
*/ */
if (take != 0) if (take != 0)
{
if (!moving) if (!moving)
pick_up(take); pick_up(take);
else else
show_floor(); show_floor();
}
if (!running) if (!running)
door_stop = FALSE; door_stop = FALSE;
} /* end while */ } /* end while */
@ -680,6 +684,7 @@ do_after_effects(void)
/* Time to enforce weapon and armor restrictions */ /* Time to enforce weapon and armor restrictions */
if (rnd(9999) == 0) if (rnd(9999) == 0)
{
if (((cur_weapon == NULL) || if (((cur_weapon == NULL) ||
(wield_ok(&player, cur_weapon, NOMESSAGE))) (wield_ok(&player, cur_weapon, NOMESSAGE)))
&& ((cur_armor == NULL) || && ((cur_armor == NULL) ||
@ -774,6 +779,7 @@ do_after_effects(void)
death(death_cause); death(death_cause);
} }
} }
}
if (rnd(500000) == 0) if (rnd(500000) == 0)
{ {
@ -1038,6 +1044,7 @@ help(void)
while (strp->h_ch) while (strp->h_ch)
{ {
if (strp->h_desc == 0) if (strp->h_desc == 0)
{
if (!wizard) if (!wizard)
break; break;
else else
@ -1045,6 +1052,7 @@ help(void)
strp++; strp++;
continue; continue;
} }
}
if (strp->h_ch == helpch) if (strp->h_ch == helpch)
{ {
@ -1071,6 +1079,7 @@ help(void)
while (strp->h_ch) while (strp->h_ch)
{ {
if (strp->h_desc == 0) if (strp->h_desc == 0)
{
if (!wizard) if (!wizard)
break; break;
else else
@ -1078,6 +1087,7 @@ help(void)
strp++; strp++;
continue; continue;
} }
}
mvwaddstr(hw, cnt % 23, cnt > 22 ? 40 : 0, unctrl(strp->h_ch)); mvwaddstr(hw, cnt % 23, cnt > 22 ? 40 : 0, unctrl(strp->h_ch));
waddstr(hw, strp->h_desc); waddstr(hw, strp->h_desc);

View file

@ -245,9 +245,8 @@ fight(coord *mp, struct object *weap, int thrown)
if (is_wearing(R_HEALTH) || if (is_wearing(R_HEALTH) ||
player.t_ctype == C_PALADIN || player.t_ctype == C_PALADIN ||
(player.t_ctype == C_NINJA && pstats.s_lvl (player.t_ctype == C_NINJA && pstats.s_lvl > 6) ||
> 6) || (thrown && rnd(50) > 0) ||
thrown && rnd(50) > 0 ||
rnd(20) > 0) rnd(20) > 0)
{ {
msg("The dust makes it hard to breath."); msg("The dust makes it hard to breath.");
@ -331,7 +330,9 @@ fight(coord *mp, struct object *weap, int thrown)
} }
if (itm == NULL) if (itm == NULL)
{
debug("Can't find crystalline armor being worn."); debug("Can't find crystalline armor being worn.");
}
else else
{ {
msg("Your armor shatters from the shriek."); msg("Your armor shatters from the shriek.");
@ -554,7 +555,9 @@ attack(struct thing *mp, struct object *weapon, int thrown)
} }
if (item == NULL) if (item == NULL)
{
debug("Can't find crystalline armor being worn."); debug("Can't find crystalline armor being worn.");
}
else else
{ {
msg("Your armor is shattered by the blow."); msg("Your armor is shattered by the blow.");
@ -1034,7 +1037,7 @@ attack(struct thing *mp, struct object *weapon, int thrown)
msg("You feel nimble fingers reach into you pack."); msg("You feel nimble fingers reach into you pack.");
} }
if ((obj != cur_armor && if (((obj != cur_armor &&
obj != cur_weapon && obj != cur_weapon &&
obj != cur_ring[LEFT_1] && obj != cur_ring[LEFT_1] &&
obj != cur_ring[LEFT_2] && obj != cur_ring[LEFT_2] &&
@ -1047,7 +1050,7 @@ attack(struct thing *mp, struct object *weapon, int thrown)
obj != cur_ring[RIGHT_4] && obj != cur_ring[RIGHT_4] &&
obj != cur_ring[RIGHT_5] && obj != cur_ring[RIGHT_5] &&
!(obj->o_flags & ISPROT) && !(obj->o_flags & ISPROT) &&
is_magic(obj) is_magic(obj))
|| level > 45) || level > 45)
&& get_worth(obj) > worth) && get_worth(obj) > worth)
{ {
@ -2100,8 +2103,8 @@ summon_help(struct thing *mons, int force)
if (on(*mons, CANSUMMON) && if (on(*mons, CANSUMMON) &&
(force == FORCE || (force == FORCE ||
(mons->t_stats.s_hpt < mons->maxstats.s_hpt / 3) && ((mons->t_stats.s_hpt < mons->maxstats.s_hpt / 3) &&
(rnd(40 * 10) < (mons->t_stats.s_lvl * mons->t_stats.s_intel)))) (rnd(40 * 10) < (mons->t_stats.s_lvl * mons->t_stats.s_intel)))))
{ {
turn_off(*mons, CANSUMMON); turn_off(*mons, CANSUMMON);
msg("The %s summons its attendants!", mname); msg("The %s summons its attendants!", mname);

View file

@ -107,7 +107,8 @@ endmsg(void)
{ {
strcpy(msgbuf[msg_index], mbuf); strcpy(msgbuf[msg_index], mbuf);
msg_index = ++msg_index % 10; msg_index++;
msg_index %= 10;
if (mpos) if (mpos)
{ {

View file

@ -109,7 +109,9 @@ md_init()
# define SE exit_standout_mode # define SE exit_standout_mode
#endif #endif
#ifdef _WIN32
static int md_standout_mode = 0; static int md_standout_mode = 0;
#endif
void void
md_raw_standout() md_raw_standout()
@ -281,7 +283,9 @@ md_gethomedir()
#endif #endif
if ( (h == NULL) || (*h == '\0') ) if ( (h == NULL) || (*h == '\0') )
{
if ( (h = getenv("HOME")) == NULL ) if ( (h = getenv("HOME")) == NULL )
{
if ( (h = getenv("HOMEDRIVE")) == NULL) if ( (h = getenv("HOMEDRIVE")) == NULL)
h = ""; h = "";
else else
@ -292,6 +296,8 @@ md_gethomedir()
if ( (h = getenv("HOMEPATH")) == NULL) if ( (h = getenv("HOMEPATH")) == NULL)
h = ""; h = "";
} }
}
}
len = strlen(homedir); len = strlen(homedir);
@ -372,7 +378,7 @@ md_shellescape()
*/ */
setuid(getuid()); setuid(getuid());
setgid(getgid()); setgid(getgid());
execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0); execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", (char *) NULL);
perror("No shelly"); perror("No shelly");
_exit(-1); _exit(-1);
} }
@ -601,6 +607,7 @@ md_getloadavg(double *avg)
avg[0] = avg[1] = avg[2] = 0.0; avg[0] = avg[1] = avg[2] = 0.0;
return -1; return -1;
} }
return 3;
} }
long long

View file

@ -36,8 +36,10 @@ static char sccsid[] = "%W%\t%G%";
#define FENCE_SIZE (sizeof(size_t) * 1024) #define FENCE_SIZE (sizeof(size_t) * 1024)
static int memdebug_level = 0; static int memdebug_level = 0;
#ifdef MEM_DEBUG
static DICTIONARY *allocations = NULL; static DICTIONARY *allocations = NULL;
static FILE *trace_file = NULL; static FILE *trace_file = NULL;
#endif
/* set the debug level */ /* set the debug level */
void mem_debug(const int level) void mem_debug(const int level)

View file

@ -207,7 +207,7 @@ look(int wakeup)
if (off(player, ISBLIND)) if (off(player, ISBLIND))
{ {
if (y == hero.y && x == hero.x || (inpass && (ch == '-' || if ((y == hero.y && x == hero.x) || (inpass && (ch == '-' ||
ch == '|'))) ch == '|')))
continue; continue;

View file

@ -892,6 +892,7 @@ wake_monster(int y, int x)
} }
} }
else if (off(player, ISBLIND)) else if (off(player, ISBLIND))
{
if (save(VS_WAND) || is_wearing(R_TRUESEE) || is_wearing(R_SEEINVIS)) if (save(VS_WAND) || is_wearing(R_TRUESEE) || is_wearing(R_SEEINVIS))
msg("Your eyes film over for a moment."); msg("Your eyes film over for a moment.");
else else
@ -902,6 +903,7 @@ wake_monster(int y, int x)
look(FALSE); look(FALSE);
} }
} }
}
if (on(*tp, LOOKSTONE)) /* Stoning */ if (on(*tp, LOOKSTONE)) /* Stoning */
{ {

View file

@ -222,7 +222,7 @@ do_move(int dy, int dx)
if ((rnd(100) < 80 && on(player, ISHUH)) || if ((rnd(100) < 80 && on(player, ISHUH)) ||
(is_wearing(R_DELUSION) && rnd(100) < 25) || (is_wearing(R_DELUSION) && rnd(100) < 25) ||
on(player, STUMBLER) && rnd(40) == 0) (on(player, STUMBLER) && rnd(40) == 0))
player.t_nxtpos = rndmove(&player); player.t_nxtpos = rndmove(&player);
else else
{ {
@ -768,10 +768,10 @@ be_trapped(struct thing *th, coord tc)
if (((is_wearing(R_LEVITATION) || on(player, CANFLY)) && if (((is_wearing(R_LEVITATION) || on(player, CANFLY)) &&
(ch != FIRETRAP || (ch != FIRETRAP ||
(ch == FIRETRAP && !(tp->tr_flags & ISFOUND)))) (ch == FIRETRAP && !(tp->tr_flags & ISFOUND))))
|| (moving && (tp->tr_flags & ISFOUND) && rnd(100) < || ((moving && (tp->tr_flags & ISFOUND) && rnd(100) <
thief_bonus + 2 * pstats.s_dext + 5 * pstats.s_lvl) && thief_bonus + 2 * pstats.s_dext + 5 * pstats.s_lvl) &&
(ch == BEARTRAP || ch == MAZETRAP || ch == TRAPDOOR (ch == BEARTRAP || ch == MAZETRAP || ch == TRAPDOOR
|| ch == ARROWTRAP || ch == DARTTRAP)) || ch == ARROWTRAP || ch == DARTTRAP)))
{ {
static char trname[1024]; static char trname[1024];
msg(tr_name(ch,trname)); msg(tr_name(ch,trname));
@ -1070,6 +1070,7 @@ be_trapped(struct thing *th, coord tc)
th->t_stats.s_hpt -= roll(1, 4); th->t_stats.s_hpt -= roll(1, 4);
if (orig_hp == th->t_stats.s_hpt) if (orig_hp == th->t_stats.s_hpt)
{
if (can_see) if (can_see)
msg("The dart has not effect!"); msg("The dart has not effect!");
else if (th->t_stats.s_hpt < 0) else if (th->t_stats.s_hpt < 0)
@ -1084,6 +1085,7 @@ be_trapped(struct thing *th, coord tc)
} }
} }
} }
}
else else
{ {
if (is_player) if (is_player)

View file

@ -264,7 +264,7 @@ new_level(LEVTYPE ltype, int special)
turn_off(player, BLESSMAP); turn_off(player, BLESSMAP);
} }
if (player.t_ctype == C_THIEF || on(player, BLESSGOLD) && rnd(5) == 0) if (player.t_ctype == C_THIEF || (on(player, BLESSGOLD) && rnd(5) == 0))
{ {
read_scroll(&player, S_GFIND, ISNORMAL); read_scroll(&player, S_GFIND, ISNORMAL);
@ -272,7 +272,8 @@ new_level(LEVTYPE ltype, int special)
turn_off(player, BLESSGOLD); turn_off(player, BLESSGOLD);
} }
if (player.t_ctype == C_RANGER || on(player, BLESSFOOD) && rnd(5) == 0) if (player.t_ctype == C_RANGER ||
(on(player, BLESSFOOD) && rnd(5) == 0))
{ {
read_scroll(&player, S_FOODDET, ISNORMAL); read_scroll(&player, S_FOODDET, ISNORMAL);
@ -281,7 +282,7 @@ new_level(LEVTYPE ltype, int special)
} }
if (player.t_ctype == C_MAGICIAN || player.t_ctype == C_ILLUSION || if (player.t_ctype == C_MAGICIAN || player.t_ctype == C_ILLUSION ||
on(player, BLESSMAGIC) && rnd(5) == 0) (on(player, BLESSMAGIC) && rnd(5) == 0))
{ {
quaff(&player, P_TREASDET, ISNORMAL); quaff(&player, P_TREASDET, ISNORMAL);
@ -289,7 +290,7 @@ new_level(LEVTYPE ltype, int special)
turn_off(player, BLESSMAGIC); turn_off(player, BLESSMAGIC);
} }
if (player.t_ctype == C_DRUID || on(player, BLESSMONS) && rnd(5) == 0) if (player.t_ctype == C_DRUID || (on(player, BLESSMONS) && rnd(5) == 0))
{ {
quaff(&player, P_MONSTDET, ISNORMAL); quaff(&player, P_MONSTDET, ISNORMAL);
@ -305,7 +306,7 @@ new_level(LEVTYPE ltype, int special)
aggravate(); aggravate();
if (is_wearing(R_ADORNMENT) || if (is_wearing(R_ADORNMENT) ||
cur_armor != NULL && cur_armor->o_which == MITHRIL) (cur_armor != NULL && cur_armor->o_which == MITHRIL))
{ {
int greed = FALSE; int greed = FALSE;

View file

@ -78,6 +78,7 @@ option(void)
retval = (*op->o_getfunc)(&op->o_opt, hw); retval = (*op->o_getfunc)(&op->o_opt, hw);
if (retval) if (retval)
{
if (retval == QUIT) if (retval == QUIT)
break; break;
else if (op > optlist) /* MINUS */ else if (op > optlist) /* MINUS */
@ -92,6 +93,7 @@ option(void)
op--; op--;
} }
} }
}
/* Switch back to original screen */ /* Switch back to original screen */

View file

@ -361,10 +361,12 @@ quaff(struct thing *quaffer, int which, int flags)
char mag_type = MAGIC; char mag_type = MAGIC;
if (blessed) if (blessed)
{
if (tp->o_flags & ISCURSED) if (tp->o_flags & ISCURSED)
mag_type = CMAGIC; mag_type = CMAGIC;
else if (tp->o_flags & ISBLESSED) else if (tp->o_flags & ISBLESSED)
mag_type = BMAGIC; mag_type = BMAGIC;
}
showit = TRUE; showit = TRUE;
mvwaddch(hw, tp->o_pos.y, tp->o_pos.x, mag_type); mvwaddch(hw, tp->o_pos.y, tp->o_pos.x, mag_type);

View file

@ -319,8 +319,8 @@ score(long amount, int lvl, int flags, int monst) /*ARGSUSED*/
{ {
char lev[20]; char lev[20];
sprintf(lev, "%ld+%ld", scp->sc_lvl, scp->sc_score); sprintf(lev, "%d+%ld", scp->sc_lvl, scp->sc_score);
printf("%4d %15s %10ld %s:", scp - top_ten + 1, printf("%4d %15s %10ld %s:", (int) (scp - top_ten + 1),
lev, lev,
scp->sc_gold, scp->sc_gold,
scp->sc_name); scp->sc_name);

View file

@ -508,11 +508,13 @@ read_scroll(struct thing *reader, int which, int flags)
obj = OBJPTR(nitem); obj = OBJPTR(nitem);
if (rnd(5) == 0) if (rnd(5) == 0)
{
if (obj->o_flags & ISBLESSED) if (obj->o_flags & ISBLESSED)
obj->o_flags &= ~ISBLESSED; obj->o_flags &= ~ISBLESSED;
else else
obj->o_flags |= ISCURSED; obj->o_flags |= ISCURSED;
} }
}
msg("The smell of fire and brimstone comes from your pack."); msg("The smell of fire and brimstone comes from your pack.");
} }
else if (blessed) else if (blessed)
@ -797,7 +799,7 @@ read_scroll(struct thing *reader, int which, int flags)
break; break;
case STICK: case STICK:
if (wizard || howmuch != 1 && rnd(5) == 0) if (wizard || (howmuch != 1 && rnd(5) == 0))
lb->o_flags |= flg; lb->o_flags |= flg;
lb->o_charges += howmuch + 10; lb->o_charges += howmuch + 10;

View file

@ -266,10 +266,12 @@ do_zap(struct thing *zapper, int which, unsigned long flags)
save_adj = -5; save_adj = -5;
if (cursed) if (cursed)
{
if (which == WS_POLYMORPH) if (which == WS_POLYMORPH)
save_adj = -5; /* not save vs becoming tougher */ save_adj = -5; /* not save vs becoming tougher */
else else
save_adj = 5; save_adj = 5;
}
if (save_throw(VS_MAGIC - save_adj, tp)) if (save_throw(VS_MAGIC - save_adj, tp))
{ {
@ -1239,7 +1241,6 @@ shoot_bolt(struct thing *shooter, coord start, coord dir, int get_points, int re
short y, x; short y, x;
coord pos; coord pos;
coord spotpos[BOLT_LENGTH + 1]; coord spotpos[BOLT_LENGTH + 1];
int ret_val = FALSE;/* True if breathing monster gets killed */
struct linked_list *item; struct linked_list *item;
struct thing *tp; struct thing *tp;
char *mname; char *mname;
@ -1419,7 +1420,6 @@ shoot_bolt(struct thing *shooter, coord start, coord dir, int get_points, int re
mname); mname);
take_that[y] += tp->t_stats.s_hpt + 1; take_that[y] += tp->t_stats.s_hpt + 1;
ret_val = TRUE;
} }
} }
else if (strcmp(name, "lightning bolt") == 0) else if (strcmp(name, "lightning bolt") == 0)
@ -1604,7 +1604,6 @@ shoot_bolt(struct thing *shooter, coord start, coord dir, int get_points, int re
on(player, ISBLIND) ? "monster" : mname); on(player, ISBLIND) ? "monster" : mname);
killed(shooter, item, NOMESSAGE, get_points); killed(shooter, item, NOMESSAGE, get_points);
ret_val = TRUE;
} }
else if (get_points) else if (get_points)
{ {

Some files were not shown because too many files have changed in this diff Show more