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);

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

@ -1032,12 +1032,9 @@ u_level(void)
void
shell(void)
{
register char *sh;
/*
* Set the terminal back to original mode
*/
sh = getenv("SHELL");
wclear(hw);
wmove(hw, lines-1, 0);
draw(hw);
@ -1138,7 +1135,7 @@ nameitem(struct linked_list *item, 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

@ -515,9 +515,11 @@ roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
}
else if (att == &pstats) { /* Player attacks monster */
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)
hplus += att->s_lvl/5; /* monks hplus varies with level */
}
else
hplus += str_plus(str_compute())+dext_plus(dex_compute());
}

View file

@ -19,6 +19,7 @@
#include "curses.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "rogue.h"
#include "mach_dep.h"
@ -293,12 +294,15 @@ init_names(void)
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];
#ifdef WIZARD
int j;
struct linked_list *weap_item, *armor_item;
struct object *obj;
weap_item = armor_item = NULL;
#endif
if (char_type == -1) {
/* See what type character will be */

View file

@ -109,7 +109,9 @@ md_init(void)
# define SE exit_standout_mode
#endif
#ifdef _WIN32
static int md_standout_mode = 0;
#endif
void
md_raw_standout(void)
@ -297,7 +299,9 @@ md_gethomedir(void)
#endif
if ( (h == NULL) || (*h == '\0') )
{
if ( (h = getenv("HOME")) == NULL )
{
if ( (h = getenv("HOMEDRIVE")) == NULL)
h = "";
else
@ -308,6 +312,8 @@ md_gethomedir(void)
if ( (h = getenv("HOMEPATH")) == NULL)
h = "";
}
}
}
len = strlen(homedir);
@ -378,7 +384,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

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

View file

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

View file

@ -240,6 +240,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 == '~')
@ -249,6 +250,7 @@ get_str(char *opt, WINDOW *win)
sp += strlen(home);
continue;
}
}
*sp++ = c;
waddstr(win, unctrl(c));
}
@ -299,6 +301,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 */
@ -311,6 +314,7 @@ option(void)
wmove(hw, 0, 0);
op--;
}
}
}
/*
* Switch back to original screen

View file

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

View file

@ -500,7 +500,7 @@ steal(void)
msg ("You can't steal from stone!");
return;
}
if (isinvisible = invisible(tp)) mname = "creature";
if ( (isinvisible = invisible(tp)) ) mname = "creature";
else mname = monster_name(tp);
/* 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 */
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);
if (prflags == REALLIFE) printf(" [in real life %.*s!%.*s]",

View file

@ -32,9 +32,6 @@ genocide(void)
register struct linked_list *ip;
register struct thing *mp;
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;
which_monst = makemonster(FALSE, "Genocide", "wipe out");

View file

@ -1366,7 +1366,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);
@ -1776,7 +1776,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

@ -91,7 +91,8 @@ do_zap(struct thing *zapper, struct object *obj, coord *direction, int which,
y += direction->y;
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)
is_player = TRUE;

View file

@ -583,7 +583,7 @@ get_dir(coord *direction)
else if (on(player, ISFLEE)) {
y = hero.y;
x = hero.x;
while (shoot_ok(winat(y, x))) {
while (shoot_ok(CCHAR( winat(y, x) ))) {
y += direction->y;
x += direction->x;
}
@ -821,7 +821,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;
@ -1150,10 +1150,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

@ -38,7 +38,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, whc, msz, *pt;
reg char ch, newitem, newtype, msz, *pt;
signed char whc;
WINDOW *thiswin;
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 */
ch = 'a';
newtype = 0;
}
else if (prompt) {
register struct magic_item *wmi;

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);

View file

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

View file

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

View file

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

View file

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

View file

@ -101,7 +101,7 @@ look(int wakeup)
*/
if (off(player, ISBLIND))
{
if (y == hero.y && x == hero.x
if ((y == hero.y && x == hero.x)
|| (inpass && (ch == '-' || ch == '|')))
continue;
}
@ -184,12 +184,15 @@ secretdoor(int y, int x)
cp.x = 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

@ -244,6 +244,7 @@ get_str(void *vopt, WINDOW *win)
continue;
}
else if (sp == buf)
{
if (c == '-')
break;
else if (c == '~')
@ -253,6 +254,7 @@ get_str(void *vopt, WINDOW *win)
sp += strlen(home);
continue;
}
}
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
*/
if (obj->o_type == SCROLL && obj->o_which == S_SCARE)
{
if (obj->o_flags & ISFOUND)
{
msg("The scroll turns to dust as you pick it up.");
@ -88,6 +89,7 @@ add_pack(struct linked_list *item, int silent)
}
else
obj->o_flags |= ISFOUND;
}
inpack++;
if (from_floor)

View file

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

View file

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

View file

@ -64,12 +64,6 @@
#define RSID_COORDLIST 0XABCD0016
#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;
#define big_endian ( *((char *)&endian) == 0x01 )

View file

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

View file

@ -153,7 +153,7 @@ over:
mvaddch(th->t_pos.y, th->t_pos.x, th->t_oldch);
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)
&& DISTANCE(th->t_pos.y, th->t_pos.x, hero.y, hero.x)
&& !on(player, ISBLIND))

View file

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

View file

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

View file

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

View file

@ -110,7 +110,9 @@ md_init(void)
#endif
}
#ifdef _WIN32
static int md_standout_mode = 0;
#endif
void
md_raw_standout(void)
@ -409,7 +411,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);
}
@ -590,6 +592,7 @@ md_getloadavg(double *avg)
avg[0] = avg[1] = avg[2] = 0.0;
return -1;
}
return 3;
}
long

View file

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

View file

@ -75,7 +75,7 @@ new_monster(THING *tp, char type, coord *cp)
tp->t_type = type;
tp->t_disguise = type;
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);
moat(cp->y, cp->x) = tp;
mp = &monsters[tp->t_type-'A'];

View file

@ -15,6 +15,7 @@
#include <curses.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "rogue.h"
#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
*/
if (obj->o_type == SCROLL && obj->o_which == S_SCARE)
{
if (obj->o_flags & ISFOUND)
{
detach(lvl_obj, obj);
@ -112,6 +113,7 @@ add_pack(THING *obj, bool silent)
}
else
obj->o_flags |= ISFOUND;
}
inpack++;
if (from_floor)
@ -256,7 +258,7 @@ inventory(THING *list, int type)
void
pick_up(char ch)
{
register THING *obj, *mp;
register THING *obj;
switch (ch)
{

View file

@ -99,10 +99,12 @@ score(int amount, int flags, char monst)
}
#ifdef WIZARD
if (wizard)
{
if (strcmp(prbuf, "names") == 0)
prflags = 1;
else if (strcmp(prbuf, "edit") == 0)
prflags = 2;
}
#endif
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++)
{
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_level);
if (scp->sc_flags == 0)
@ -414,10 +416,12 @@ total_winner(void)
worth = r_magic[obj->o_which].mi_worth;
if (obj->o_which == R_ADDSTR || obj->o_which == R_ADDDAM ||
obj->o_which == R_PROTECT || obj->o_which == R_ADDHIT)
{
if (obj->o_ac > 0)
worth += obj->o_ac * 100;
else
worth = 10;
}
if (!(obj->o_flags & ISKNOW))
worth /= 2;
obj->o_flags |= ISKNOW;

View file

@ -10,6 +10,10 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
typedef struct {
const char *st_name;
const int st_value;
@ -50,7 +54,7 @@ extern const char *metal[];
/*
* 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 otherwise break;default
#define until(expr) while(!(expr))
@ -83,7 +87,7 @@ extern const char *metal[];
#define moat(y,x) (_monst[((x) << 5) + (y)])
#define unc(cp) (cp).y, (cp).x
#ifdef WIZARD
#define debug if (wizard) msg
#define debug if (wizard) msg
#endif
/*
@ -532,6 +536,9 @@ void fuse(void (*func)(), int arg, int time, int type);
void genocide(void);
bool get_dir(void);
THING *get_item(char *purpose, int type);
#ifdef WIZARD
int get_num(short *opt, WINDOW *win);
#endif
int get_str(char *opt, WINDOW *win);
void give_pack(THING *tp);
bool hit_monster(int y, int x, THING *obj);
@ -542,7 +549,7 @@ void init_names(void);
void init_player(void);
void init_stones(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);
bool inventory(THING *list, int type);
void invis_on(void);
@ -633,9 +640,6 @@ void whatis(bool insist);
void wield(void);
void writelog(int amount, int flags, char monst);
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "extern.h"
#ifndef PATH_MAX

View file

@ -235,7 +235,7 @@ leave_room(coord *cp)
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 (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 TRAP:
@ -251,6 +251,7 @@ leave_room(coord *cp)
* standout bit
*/
if (isupper(toascii(ch)))
{
if (on(player, SEEMONST))
{
standout();
@ -270,6 +271,7 @@ leave_room(coord *cp)
msg("couldn't find monster in leave_room at (%d,%d)", y, x);
#endif
}
}
addch(floor);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -64,12 +64,6 @@
#define RSID_COORDLIST 0XABCD0016
#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;
#define big_endian ( *((char *)&endian) == 0x01 )

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;

View file

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

View file

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

View file

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

View file

@ -109,7 +109,9 @@ md_init()
# define SE exit_standout_mode
#endif
#ifdef _WIN32
static int md_standout_mode = 0;
#endif
void
md_raw_standout()
@ -281,7 +283,9 @@ md_gethomedir()
#endif
if ( (h == NULL) || (*h == '\0') )
{
if ( (h = getenv("HOME")) == NULL )
{
if ( (h = getenv("HOMEDRIVE")) == NULL)
h = "";
else
@ -292,6 +296,8 @@ md_gethomedir()
if ( (h = getenv("HOMEPATH")) == NULL)
h = "";
}
}
}
len = strlen(homedir);
@ -372,7 +378,7 @@ md_shellescape()
*/
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);
}
@ -601,6 +607,7 @@ md_getloadavg(double *avg)
avg[0] = avg[1] = avg[2] = 0.0;
return -1;
}
return 3;
}
long

View file

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

View file

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

View file

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

View file

@ -222,7 +222,7 @@ do_move(int dy, int dx)
if ((rnd(100) < 80 && on(player, ISHUH)) ||
(is_wearing(R_DELUSION) && rnd(100) < 25) ||
on(player, STUMBLER) && rnd(40) == 0)
(on(player, STUMBLER) && rnd(40) == 0))
player.t_nxtpos = rndmove(&player);
else
{
@ -768,10 +768,10 @@ be_trapped(struct thing *th, coord tc)
if (((is_wearing(R_LEVITATION) || on(player, CANFLY)) &&
(ch != FIRETRAP ||
(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) &&
(ch == BEARTRAP || ch == MAZETRAP || ch == TRAPDOOR
|| ch == ARROWTRAP || ch == DARTTRAP))
|| ch == ARROWTRAP || ch == DARTTRAP)))
{
static char trname[1024];
msg(tr_name(ch,trname));
@ -1070,6 +1070,7 @@ be_trapped(struct thing *th, coord tc)
th->t_stats.s_hpt -= roll(1, 4);
if (orig_hp == th->t_stats.s_hpt)
{
if (can_see)
msg("The dart has not effect!");
else if (th->t_stats.s_hpt < 0)
@ -1082,6 +1083,7 @@ be_trapped(struct thing *th, coord tc)
killed(NULL, mitem, NOMESSAGE, NOPOINTS);
}
}
}
}
else

View file

@ -264,7 +264,7 @@ new_level(LEVTYPE ltype, int special)
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);
@ -272,7 +272,8 @@ new_level(LEVTYPE ltype, int special)
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);
@ -281,7 +282,7 @@ new_level(LEVTYPE ltype, int special)
}
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);
@ -289,7 +290,7 @@ new_level(LEVTYPE ltype, int special)
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);
@ -305,7 +306,7 @@ new_level(LEVTYPE ltype, int special)
aggravate();
if (is_wearing(R_ADORNMENT) ||
cur_armor != NULL && cur_armor->o_which == MITHRIL)
(cur_armor != NULL && cur_armor->o_which == MITHRIL))
{
int greed = FALSE;

View file

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

View file

@ -361,10 +361,12 @@ quaff(struct thing *quaffer, int which, int flags)
char mag_type = MAGIC;
if (blessed)
{
if (tp->o_flags & ISCURSED)
mag_type = CMAGIC;
else if (tp->o_flags & ISBLESSED)
mag_type = BMAGIC;
}
showit = TRUE;
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];
sprintf(lev, "%ld+%ld", scp->sc_lvl, scp->sc_score);
printf("%4d %15s %10ld %s:", scp - top_ten + 1,
sprintf(lev, "%d+%ld", scp->sc_lvl, scp->sc_score);
printf("%4d %15s %10ld %s:", (int) (scp - top_ten + 1),
lev,
scp->sc_gold,
scp->sc_name);

View file

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

View file

@ -266,10 +266,12 @@ do_zap(struct thing *zapper, int which, unsigned long flags)
save_adj = -5;
if (cursed)
{
if (which == WS_POLYMORPH)
save_adj = -5; /* not save vs becoming tougher */
else
save_adj = 5;
}
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;
coord pos;
coord spotpos[BOLT_LENGTH + 1];
int ret_val = FALSE;/* True if breathing monster gets killed */
struct linked_list *item;
struct thing *tp;
char *mname;
@ -1419,7 +1420,6 @@ shoot_bolt(struct thing *shooter, coord start, coord dir, int get_points, int re
mname);
take_that[y] += tp->t_stats.s_hpt + 1;
ret_val = TRUE;
}
}
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);
killed(shooter, item, NOMESSAGE, get_points);
ret_val = TRUE;
}
else if (get_points)
{

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