# HG changeset patch # User John "Elwin" Edwards # Date 1618440933 14400 # Node ID e52a8a7ad4c57b80e9b7d4ae586019ac878ca344 # Parent e06ebc40761538ff396c870c572496d693d823c4 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. diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/chase.c --- a/arogue5/chase.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/chase.c Wed Apr 14 18:55:33 2021 -0400 @@ -65,7 +65,7 @@ /* 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 diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/command.c --- a/arogue5/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -921,7 +921,7 @@ } 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; } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/main.c --- a/arogue5/main.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/main.c Wed Apr 14 18:55:33 2021 -0400 @@ -50,9 +50,11 @@ main(int argc, char *argv[], char *envp[]) { register char *env; +#ifndef SCOREFILE char *roguedir; roguedir = md_getroguedir(); +#endif md_init(); /* diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/mdport.c --- a/arogue5/mdport.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/mdport.c Wed Apr 14 18:55:33 2021 -0400 @@ -112,7 +112,9 @@ # define SE exit_standout_mode #endif +#ifdef _WIN32 static int md_standout_mode = 0; +#endif void md_raw_standout(void) @@ -292,7 +294,9 @@ #endif if ( (h == NULL) || (*h == '\0') ) + { if ( (h = getenv("HOME")) == NULL ) + { if ( (h = getenv("HOMEDRIVE")) == NULL) h = ""; else @@ -303,6 +307,8 @@ if ( (h = getenv("HOMEPATH")) == NULL) h = ""; } + } + } len = strlen(homedir); @@ -375,7 +381,7 @@ */ 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); } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/misc.c --- a/arogue5/misc.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/misc.c Wed Apr 14 18:55:33 2021 -0400 @@ -447,10 +447,9 @@ { 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 @@ return; obj = OBJPTR(item); - cursed = (obj->o_flags & ISCURSED) != 0; - blessed = (obj->o_flags & ISBLESSED) != 0; which = obj->o_which; } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/monsters.c --- a/arogue5/monsters.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/monsters.c Wed Apr 14 18:55:33 2021 -0400 @@ -730,14 +730,12 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/move.c --- a/arogue5/move.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/move.c Wed Apr 14 18:55:33 2021 -0400 @@ -1339,7 +1339,7 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/options.c --- a/arogue5/options.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/options.c Wed Apr 14 18:55:33 2021 -0400 @@ -267,6 +267,7 @@ continue; } else if (sp == buf) + { if (c == '-' && win == hw) /* To move back a line in hw */ break; else if (c == '~') @@ -276,6 +277,7 @@ sp += strlen(home); continue; } + } *sp++ = c; waddstr(win, unctrl(c)); } @@ -326,6 +328,7 @@ { 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 @@ wmove(hw, 0, 0); op--; } + } } /* * Switch back to original screen diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/passages.c --- a/arogue5/passages.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/passages.c Wed Apr 14 18:55:33 2021 -0400 @@ -139,7 +139,7 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/player.c --- a/arogue5/player.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/player.c Wed Apr 14 18:55:33 2021 -0400 @@ -522,7 +522,7 @@ 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? */ diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/rip.c --- a/arogue5/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -511,7 +511,7 @@ /* 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]", diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/save.c --- a/arogue5/save.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/save.c Wed Apr 14 18:55:33 2021 -0400 @@ -128,8 +128,6 @@ save_file(FILE *savef) { int ret; - int slines = LINES; - int scols = COLS; wmove(cw, LINES-1, 0); draw(cw); diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/state.c --- a/arogue5/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -1318,7 +1318,7 @@ 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 @@ 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) diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/sticks.c --- a/arogue5/sticks.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/sticks.c Wed Apr 14 18:55:33 2021 -0400 @@ -154,7 +154,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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; } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/util.c --- a/arogue5/util.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/util.c Wed Apr 14 18:55:33 2021 -0400 @@ -624,7 +624,7 @@ */ 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 @@ 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'); } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/wizard.c --- a/arogue5/wizard.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/wizard.c Wed Apr 14 18:55:33 2021 -0400 @@ -30,7 +30,8 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 arogue5/xcrypt.c --- a/arogue5/xcrypt.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue5/xcrypt.c Wed Apr 14 18:55:33 2021 -0400 @@ -601,7 +601,7 @@ 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 @@ /* * 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 @@ *key) *q++ ^= *key++ << 1; - if (des_setkey((unsigned char *) keybuf)) + if (des_setkey((char *) keybuf)) return(NULL); } strncpy((char *)output, setting, 9); diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/chase.c --- a/arogue7/chase.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/chase.c Wed Apr 14 18:55:33 2021 -0400 @@ -65,7 +65,7 @@ /* 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 diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/command.c --- a/arogue7/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -1032,12 +1032,9 @@ 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 @@ } 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; } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/fight.c --- a/arogue7/fight.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/fight.c Wed Apr 14 18:55:33 2021 -0400 @@ -515,9 +515,11 @@ } 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()); } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/init.c --- a/arogue7/init.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/init.c Wed Apr 14 18:55:33 2021 -0400 @@ -19,6 +19,7 @@ #include "curses.h" #include +#include #include #include "rogue.h" #include "mach_dep.h" @@ -293,12 +294,15 @@ 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 */ diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/mdport.c --- a/arogue7/mdport.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/mdport.c Wed Apr 14 18:55:33 2021 -0400 @@ -109,7 +109,9 @@ # define SE exit_standout_mode #endif +#ifdef _WIN32 static int md_standout_mode = 0; +#endif void md_raw_standout(void) @@ -297,7 +299,9 @@ #endif if ( (h == NULL) || (*h == '\0') ) + { if ( (h = getenv("HOME")) == NULL ) + { if ( (h = getenv("HOMEDRIVE")) == NULL) h = ""; else @@ -308,6 +312,8 @@ if ( (h = getenv("HOMEPATH")) == NULL) h = ""; } + } + } len = strlen(homedir); @@ -378,7 +384,7 @@ */ 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); } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/misc.c --- a/arogue7/misc.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/misc.c Wed Apr 14 18:55:33 2021 -0400 @@ -843,9 +843,8 @@ { 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 @@ is_mm = TRUE; obj = OBJPTR(item); - cursed = (obj->o_flags & ISCURSED) != 0; - blessed = (obj->o_flags & ISBLESSED) != 0; which = obj->o_which; } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/move.c --- a/arogue7/move.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/move.c Wed Apr 14 18:55:33 2021 -0400 @@ -1752,7 +1752,7 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/options.c --- a/arogue7/options.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/options.c Wed Apr 14 18:55:33 2021 -0400 @@ -240,6 +240,7 @@ continue; } else if (sp == buf) + { if (c == '-' && win == hw) /* To move back a line in hw */ break; else if (c == '~') @@ -249,6 +250,7 @@ sp += strlen(home); continue; } + } *sp++ = c; waddstr(win, unctrl(c)); } @@ -299,6 +301,7 @@ { 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 @@ wmove(hw, 0, 0); op--; } + } } /* * Switch back to original screen diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/passages.c --- a/arogue7/passages.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/passages.c Wed Apr 14 18:55:33 2021 -0400 @@ -143,7 +143,7 @@ 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]; diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/player.c --- a/arogue7/player.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/player.c Wed Apr 14 18:55:33 2021 -0400 @@ -500,7 +500,7 @@ 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? */ diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/rip.c --- a/arogue7/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -580,7 +580,7 @@ /* 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]", diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/scrolls.c --- a/arogue7/scrolls.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/scrolls.c Wed Apr 14 18:55:33 2021 -0400 @@ -32,9 +32,6 @@ 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"); diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/state.c --- a/arogue7/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -1366,7 +1366,7 @@ 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 @@ 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) diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/sticks.c --- a/arogue7/sticks.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/sticks.c Wed Apr 14 18:55:33 2021 -0400 @@ -91,7 +91,8 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/util.c --- a/arogue7/util.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/util.c Wed Apr 14 18:55:33 2021 -0400 @@ -583,7 +583,7 @@ 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 @@ */ 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 @@ 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'); } diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/wizard.c --- a/arogue7/wizard.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/wizard.c Wed Apr 14 18:55:33 2021 -0400 @@ -38,7 +38,8 @@ 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 @@ } if(msz == 1) { /* if only one type of item */ ch = 'a'; + newtype = 0; } else if (prompt) { register struct magic_item *wmi; diff -r e06ebc407615 -r e52a8a7ad4c5 arogue7/xcrypt.c --- a/arogue7/xcrypt.c Sat Mar 20 22:36:52 2021 -0400 +++ b/arogue7/xcrypt.c Wed Apr 14 18:55:33 2021 -0400 @@ -601,7 +601,7 @@ 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 @@ /* * 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 @@ *key) *q++ ^= *key++ << 1; - if (des_setkey((unsigned char *) keybuf)) + if (des_setkey((char *) keybuf)) return(NULL); } strncpy((char *)output, setting, 9); diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/command.c --- a/rogue3/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -203,7 +203,7 @@ } else { - if (wizard = passwd()) + if ( (wizard = passwd()) ) { msg("You are suddenly as smart as Ken Arnold in dungeon #%d", dnum); wizard = TRUE; diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/fight.c --- a/rogue3/fight.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/fight.c Wed Apr 14 18:55:33 2021 -0400 @@ -158,6 +158,7 @@ * Ants have poisonous bites */ if (!save(VS_POISON)) + { if (!ISWEARING(R_SUSTSTR)) { chg_str(-1); @@ -167,10 +168,13 @@ 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 diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/init.c --- a/rogue3/init.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/init.c Wed Apr 14 18:55:33 2021 -0400 @@ -261,13 +261,13 @@ 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] = { diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/main.c --- a/rogue3/main.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/main.c Wed Apr 14 18:55:33 2021 -0400 @@ -419,9 +419,9 @@ int too_much() { +#ifdef MAXLOAD double avec[3]; -#ifdef MAXLOAD if (md_loadav(avec) == 0) return (avec[2] > (MAXLOAD / 10.0)); #endif diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/misc.c --- a/rogue3/misc.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/misc.c Wed Apr 14 18:55:33 2021 -0400 @@ -101,7 +101,7 @@ */ 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 @@ 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'); } diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/options.c --- a/rogue3/options.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/options.c Wed Apr 14 18:55:33 2021 -0400 @@ -244,6 +244,7 @@ continue; } else if (sp == buf) + { if (c == '-') break; else if (c == '~') @@ -253,6 +254,7 @@ sp += strlen(home); continue; } + } if ((sp - buf) < 78) /* Avoid overflow */ { diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/pack.c --- a/rogue3/pack.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/pack.c Wed Apr 14 18:55:33 2021 -0400 @@ -79,6 +79,7 @@ * 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 @@ } else obj->o_flags |= ISFOUND; + } inpack++; if (from_floor) diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/passages.c --- a/rogue3/passages.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/passages.c Wed Apr 14 18:55:33 2021 -0400 @@ -206,7 +206,10 @@ 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. diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/rip.c --- a/rogue3/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -192,10 +192,12 @@ 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 @@ 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 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/state.c --- a/rogue3/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -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 ) diff -r e06ebc407615 -r e52a8a7ad4c5 rogue3/weapons.c --- a/rogue3/weapons.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue3/weapons.c Wed Apr 14 18:55:33 2021 -0400 @@ -174,10 +174,12 @@ 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); } diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/chase.c --- a/rogue4/chase.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/chase.c Wed Apr 14 18:55:33 2021 -0400 @@ -153,7 +153,7 @@ 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)) diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/command.c --- a/rogue4/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -249,7 +249,7 @@ } else { - if (wizard = passwd()) + if ( (wizard = passwd()) ) { noscore = TRUE; turn_see(FALSE); diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/extern.h --- a/rogue4/extern.h Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/extern.h Wed Apr 14 18:55:33 2021 -0400 @@ -59,9 +59,9 @@ 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 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); diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/fight.c --- a/rogue4/fight.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/fight.c Wed Apr 14 18:55:33 2021 -0400 @@ -137,6 +137,7 @@ */ 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 @@ else msg("your armor weakens"); } + } when 'E': /* * The gaze of the floating eye hypnotizes you @@ -167,6 +169,7 @@ * Ants have poisonous bites */ if (!save(VS_POISON)) + { if (!ISWEARING(R_SUSTSTR)) { chg_str(-1); @@ -176,10 +179,13 @@ 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': /* diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/mdport.c --- a/rogue4/mdport.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/mdport.c Wed Apr 14 18:55:33 2021 -0400 @@ -110,7 +110,9 @@ #endif } +#ifdef _WIN32 static int md_standout_mode = 0; +#endif void md_raw_standout(void) @@ -409,7 +411,7 @@ */ 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 @@ avg[0] = avg[1] = avg[2] = 0.0; return -1; } + return 3; } long diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/misc.c --- a/rogue4/misc.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/misc.c Wed Apr 14 18:55:33 2021 -0400 @@ -58,9 +58,7 @@ 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 @@ 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 @@ if (see_monst(tp)) ch = tp->t_disguise; } + } move(y, x); if (ch != inch()) diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/monsters.c --- a/rogue4/monsters.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/monsters.c Wed Apr 14 18:55:33 2021 -0400 @@ -75,7 +75,7 @@ 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']; diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/options.c --- a/rogue4/options.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/options.c Wed Apr 14 18:55:33 2021 -0400 @@ -15,6 +15,7 @@ #include #include #include +#include #include "rogue.h" #define EQSTR(a, b, c) (strncmp(a, b, c) == 0) diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/pack.c --- a/rogue4/pack.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/pack.c Wed Apr 14 18:55:33 2021 -0400 @@ -102,6 +102,7 @@ * 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 @@ } else obj->o_flags |= ISFOUND; + } inpack++; if (from_floor) @@ -256,7 +258,7 @@ void pick_up(char ch) { - register THING *obj, *mp; + register THING *obj; switch (ch) { diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/rip.c --- a/rogue4/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -99,10 +99,12 @@ } #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 @@ 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 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/rogue.h --- a/rogue4/rogue.h Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/rogue.h Wed Apr 14 18:55:33 2021 -0400 @@ -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 @@ /* * 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 @@ #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 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_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 wield(void); void writelog(int amount, int flags, char monst); -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include "extern.h" #ifndef PATH_MAX diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/rooms.c --- a/rogue4/rooms.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/rooms.c Wed Apr 14 18:55:33 2021 -0400 @@ -235,7 +235,7 @@ 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 @@ * standout bit */ if (isupper(toascii(ch))) + { if (on(player, SEEMONST)) { standout(); @@ -270,6 +271,7 @@ msg("couldn't find monster in leave_room at (%d,%d)", y, x); #endif } + } addch(floor); } diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/state.c --- a/rogue4/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -2078,7 +2078,9 @@ int rs_restore_file(FILE *inf) { +#ifndef WIZARD bool junk; +#endif THING *mitem; int endian = 0x01020304; big_endian = ( *((char *)&endian) == 0x01 ); diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/sticks.c --- a/rogue4/sticks.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/sticks.c Wed Apr 14 18:55:33 2021 -0400 @@ -159,7 +159,8 @@ 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 @@ 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 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/things.c --- a/rogue4/things.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/things.c Wed Apr 14 18:55:33 2021 -0400 @@ -287,10 +287,12 @@ * 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; diff -r e06ebc407615 -r e52a8a7ad4c5 rogue4/weapons.c --- a/rogue4/weapons.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue4/weapons.c Wed Apr 14 18:55:33 2021 -0400 @@ -162,7 +162,7 @@ * 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; diff -r e06ebc407615 -r e52a8a7ad4c5 rogue5/mach_dep.c --- a/rogue5/mach_dep.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue5/mach_dep.c Wed Apr 14 18:55:33 2021 -0400 @@ -377,12 +377,15 @@ } #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) { diff -r e06ebc407615 -r e52a8a7ad4c5 rogue5/rip.c --- a/rogue5/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue5/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -108,10 +108,12 @@ #ifdef MASTER if (wizard) + { if (strcmp(prbuf, "names") == 0) prflags = 1; else if (strcmp(prbuf, "edit") == 0) prflags = 2; + } #endif rd_score(top_ten); /* diff -r e06ebc407615 -r e52a8a7ad4c5 rogue5/state.c --- a/rogue5/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/rogue5/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -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 ) diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/armor.c --- a/srogue/armor.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/armor.c Wed Apr 14 18:55:33 2021 -0400 @@ -75,12 +75,10 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/chase.c --- a/srogue/chase.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/chase.c Wed Apr 14 18:55:33 2021 -0400 @@ -210,7 +210,7 @@ } 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 @@ { 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; } diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/command.c --- a/srogue/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -638,14 +638,10 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/disply.c --- a/srogue/disply.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/disply.c Wed Apr 14 18:55:33 2021 -0400 @@ -30,7 +30,7 @@ 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 @@ 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 @@ 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 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/init.c --- a/srogue/init.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/init.c Wed Apr 14 18:55:33 2021 -0400 @@ -122,7 +122,6 @@ init_colors(void) { reg int i, j; - reg char *str; bool used[NCOLORS]; for (i = 0; i < NCOLORS; i++) @@ -185,7 +184,6 @@ init_stones(void) { reg int i, j; - reg char *str; bool used[NSTONES]; for (i = 0; i < NSTONES; i++) diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/io.c --- a/srogue/io.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/io.c Wed Apr 14 18:55:33 2021 -0400 @@ -136,8 +136,6 @@ int readchar(void) { - char c; - fflush(stdout); return( md_readchar(cw) ); } diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/misc.c --- a/srogue/misc.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/misc.c Wed Apr 14 18:55:33 2021 -0400 @@ -133,7 +133,7 @@ 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) diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/monsters.c --- a/srogue/monsters.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/monsters.c Wed Apr 14 18:55:33 2021 -0400 @@ -102,7 +102,7 @@ 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 @@ * 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 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/move.c --- a/srogue/move.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/move.c Wed Apr 14 18:55:33 2021 -0400 @@ -203,7 +203,7 @@ 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 @@ 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 @@ 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 @@ { 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) diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/new_leve.c --- a/srogue/new_leve.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/new_leve.c Wed Apr 14 18:55:33 2021 -0400 @@ -26,7 +26,6 @@ void new_level(int ltype) { - register int i; register char ch; struct coord traploc; struct room *rp; @@ -136,7 +135,7 @@ } 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; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/passages.c --- a/srogue/passages.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/passages.c Wed Apr 14 18:55:33 2021 -0400 @@ -132,7 +132,7 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/rings.c --- a/srogue/rings.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/rings.c Wed Apr 14 18:55:33 2021 -0400 @@ -288,7 +288,7 @@ ring_eat(void) { reg struct object *lb; - reg int hand, i, howmuch; + reg int i, howmuch; bool addit; howmuch = 0; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/rip.c --- a/srogue/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -288,9 +288,9 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/rooms.c --- a/srogue/rooms.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/rooms.c Wed Apr 14 18:55:33 2021 -0400 @@ -31,9 +31,7 @@ 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 diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/save.c --- a/srogue/save.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/save.c Wed Apr 14 18:55:33 2021 -0400 @@ -55,7 +55,6 @@ bool save_game(void) { - reg FILE *savef; reg int c; char buf[LINLEN]; @@ -191,8 +190,6 @@ bool restore(char *file, char **envp) { - register int pid; - int ret_status; #ifndef _AIX extern char **environ; #endif @@ -305,4 +302,5 @@ restscr(cw); md_srandom(md_random_seed()); playit(); + return FALSE; } diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/scrolls.c --- a/srogue/scrolls.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/scrolls.c Wed Apr 14 18:55:33 2021 -0400 @@ -32,7 +32,6 @@ 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 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/state.c --- a/srogue/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -832,7 +832,6 @@ 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 @@ int rs_restore_file(FILE *inf) { +#ifndef WIZARD bool junk; +#endif int endian = 0x01020304; big_endian = ( *((char *)&endian) == 0x01 ); diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/sticks.c --- a/srogue/sticks.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/sticks.c Wed Apr 14 18:55:33 2021 -0400 @@ -219,7 +219,7 @@ 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 @@ 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; } } } diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/things.c --- a/srogue/things.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/things.c Wed Apr 14 18:55:33 2021 -0400 @@ -223,7 +223,7 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/trader.c --- a/srogue/trader.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/trader.c Wed Apr 14 18:55:33 2021 -0400 @@ -299,7 +299,6 @@ void do_maze(void) { - struct coord tp; reg int i, least; reg struct room *rp; bool treas; @@ -485,7 +484,7 @@ void crankout(void) { - reg int x, y, i; + reg int x, y; for (y = 0; y < LINES - 3; y++) { move(y + 1, 0); diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/weapons.c --- a/srogue/weapons.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/weapons.c Wed Apr 14 18:55:33 2021 -0400 @@ -141,10 +141,12 @@ } 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); } diff -r e06ebc407615 -r e52a8a7ad4c5 srogue/wizard.c --- a/srogue/wizard.c Sat Mar 20 22:36:52 2021 -0400 +++ b/srogue/wizard.c Wed Apr 14 18:55:33 2021 -0400 @@ -319,7 +319,7 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/command.c --- a/urogue/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -33,7 +33,9 @@ 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 @@ * 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 @@ } } } - } + } - /* 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 @@ death(death_cause); } } + } if (rnd(500000) == 0) { @@ -1038,6 +1044,7 @@ while (strp->h_ch) { if (strp->h_desc == 0) + { if (!wizard) break; else @@ -1045,6 +1052,7 @@ strp++; continue; } + } if (strp->h_ch == helpch) { @@ -1071,6 +1079,7 @@ while (strp->h_ch) { if (strp->h_desc == 0) + { if (!wizard) break; else @@ -1078,6 +1087,7 @@ strp++; continue; } + } mvwaddstr(hw, cnt % 23, cnt > 22 ? 40 : 0, unctrl(strp->h_ch)); waddstr(hw, strp->h_desc); diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/fight.c --- a/urogue/fight.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/fight.c Wed Apr 14 18:55:33 2021 -0400 @@ -245,9 +245,8 @@ 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 @@ } if (itm == NULL) + { debug("Can't find crystalline armor being worn."); + } else { msg("Your armor shatters from the shriek."); @@ -554,7 +555,9 @@ } if (item == NULL) + { debug("Can't find crystalline armor being worn."); + } else { msg("Your armor is shattered by the blow."); @@ -1034,20 +1037,20 @@ 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 @@ /* 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); diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/io.c --- a/urogue/io.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/io.c Wed Apr 14 18:55:33 2021 -0400 @@ -107,7 +107,8 @@ { strcpy(msgbuf[msg_index], mbuf); - msg_index = ++msg_index % 10; + msg_index++; + msg_index %= 10; if (mpos) { diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/mdport.c --- a/urogue/mdport.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/mdport.c Wed Apr 14 18:55:33 2021 -0400 @@ -109,7 +109,9 @@ # define SE exit_standout_mode #endif +#ifdef _WIN32 static int md_standout_mode = 0; +#endif void md_raw_standout() @@ -281,7 +283,9 @@ #endif if ( (h == NULL) || (*h == '\0') ) + { if ( (h = getenv("HOME")) == NULL ) + { if ( (h = getenv("HOMEDRIVE")) == NULL) h = ""; else @@ -292,6 +296,8 @@ if ( (h = getenv("HOMEPATH")) == NULL) h = ""; } + } + } len = strlen(homedir); @@ -372,7 +378,7 @@ */ 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 @@ avg[0] = avg[1] = avg[2] = 0.0; return -1; } + return 3; } long diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/memory.c --- a/urogue/memory.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/memory.c Wed Apr 14 18:55:33 2021 -0400 @@ -36,8 +36,10 @@ #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) diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/misc.c --- a/urogue/misc.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/misc.c Wed Apr 14 18:55:33 2021 -0400 @@ -207,7 +207,7 @@ if (off(player, ISBLIND)) { - if (y == hero.y && x == hero.x || (inpass && (ch == '-' || + if ((y == hero.y && x == hero.x) || (inpass && (ch == '-' || ch == '|'))) continue; diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/monsters.c --- a/urogue/monsters.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/monsters.c Wed Apr 14 18:55:33 2021 -0400 @@ -892,6 +892,7 @@ } } 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 @@ light_fuse(FUSE_SIGHT, 0, rnd(30) + 20, AFTER); look(FALSE); } + } } if (on(*tp, LOOKSTONE)) /* Stoning */ diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/move.c --- a/urogue/move.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/move.c Wed Apr 14 18:55:33 2021 -0400 @@ -222,7 +222,7 @@ 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 @@ 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 @@ 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 @@ killed(NULL, mitem, NOMESSAGE, NOPOINTS); } + } } } else diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/newlvl.c --- a/urogue/newlvl.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/newlvl.c Wed Apr 14 18:55:33 2021 -0400 @@ -264,7 +264,7 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/options.c --- a/urogue/options.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/options.c Wed Apr 14 18:55:33 2021 -0400 @@ -78,6 +78,7 @@ retval = (*op->o_getfunc)(&op->o_opt, hw); if (retval) + { if (retval == QUIT) break; else if (op > optlist) /* MINUS */ @@ -91,6 +92,7 @@ wmove(hw, 0, 0); op--; } + } } /* Switch back to original screen */ diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/potions.c --- a/urogue/potions.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/potions.c Wed Apr 14 18:55:33 2021 -0400 @@ -361,10 +361,12 @@ 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); diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/rip.c --- a/urogue/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -319,8 +319,8 @@ { 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); diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/scrolls.c --- a/urogue/scrolls.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/scrolls.c Wed Apr 14 18:55:33 2021 -0400 @@ -508,10 +508,12 @@ 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 @@ 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; diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/sticks.c --- a/urogue/sticks.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/sticks.c Wed Apr 14 18:55:33 2021 -0400 @@ -266,10 +266,12 @@ 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 @@ 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 @@ mname); take_that[y] += tp->t_stats.s_hpt + 1; - ret_val = TRUE; } } else if (strcmp(name, "lightning bolt") == 0) @@ -1604,7 +1604,6 @@ on(player, ISBLIND) ? "monster" : mname); killed(shooter, item, NOMESSAGE, get_points); - ret_val = TRUE; } else if (get_points) { diff -r e06ebc407615 -r e52a8a7ad4c5 urogue/xcrypt.c --- a/urogue/xcrypt.c Sat Mar 20 22:36:52 2021 -0400 +++ b/urogue/xcrypt.c Wed Apr 14 18:55:33 2021 -0400 @@ -201,9 +201,8 @@ static void des_init() { - int j, b, k, inbit, obit; + int i, j, b, k, inbit, obit; unsigned int *p, *il, *ir, *fl, *fr; - unsigned char i; old_rawkey0 = old_rawkey1 = 0; saltbits = 0; diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/actions.c --- a/xrogue/actions.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/actions.c Wed Apr 14 18:55:33 2021 -0400 @@ -435,8 +435,8 @@ * of the room, the monster would already be on the best door out; * so he would never move. */ - if ((sch = mvwinch(stdscr, th->t_pos.y, th->t_pos.x)) == DOOR || - sch == SECRETDOOR || sch == PASSAGE) { + sch = mvwinch(stdscr, th->t_pos.y, th->t_pos.x) & A_CHARTEXT; + if (sch == DOOR || sch == SECRETDOOR || sch == PASSAGE) { rer = NULL; } this = *th->t_dest; @@ -464,7 +464,8 @@ char dch='\0'; /* Door character */ if ((th->t_doorgoal.x != -1) && (th->t_doorgoal.y != -1)) - dch = mvwinch(stdscr, th->t_doorgoal.y, th->t_doorgoal.x); + dch = mvwinch(stdscr, th->t_doorgoal.y, th->t_doorgoal.x) & + A_CHARTEXT; /* Do we have a valid goal? */ if ((dch == PASSAGE || dch == DOOR) && /* A real door */ @@ -488,7 +489,7 @@ exitx = exit->x; /* Make sure it is a real door */ - dch = mvwinch(stdscr, exity, exitx); + dch = mvwinch(stdscr, exity, exitx) & A_CHARTEXT; if (dch == PASSAGE || dch == DOOR) { /* Don't count a door if we are fleeing from someone and * he is standing on it. Also, don't count it if he is diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/bolt.c --- a/xrogue/bolt.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/bolt.c Wed Apr 14 18:55:33 2021 -0400 @@ -53,9 +53,9 @@ bounces = 0; /* No bounces yet */ nofont(cw); for (y = 0; y < BOLT_LENGTH && !used; y++) { - ch = winat(pos.y, pos.x); + ch = winat(pos.y, pos.x) & A_CHARTEXT; spotpos[y].place = pos; - spotpos[y].oldch = mvwinch(cw, pos.y, pos.x); + spotpos[y].oldch = mvwinch(cw, pos.y, pos.x) & A_CHARTEXT; /* Are we at hero? */ if (ce(pos, hero)) goto at_hero; @@ -70,8 +70,8 @@ dir.x = -dir.x; } else { - unsigned char chx = mvinch(pos.y-dir.y, pos.x), - chy = mvinch(pos.y, pos.x-dir.x); + unsigned char chx = mvinch(pos.y-dir.y, pos.x) & A_CHARTEXT, + chy = mvinch(pos.y, pos.x-dir.x) & A_CHARTEXT; bool anychange = FALSE; /* Did we change anthing */ if (chy == WALL || chy == SECRETDOOR || diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/chase.c --- a/xrogue/chase.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/chase.c Wed Apr 14 18:55:33 2021 -0400 @@ -62,7 +62,7 @@ /* Is it OK to move there? */ if (step_ok(y, x, NOMONST, tp) && - (!isatrap(mvwinch(cw, y, x)) || + (!isatrap(mvwinch(cw, y, x) & A_CHARTEXT) || rnd(10) >= tp->t_stats.s_intel || on(*tp, ISFLY))) { /* OK, we can go here. But don't go there if @@ -92,7 +92,7 @@ mvwaddch(cw, tp->t_pos.y, tp->t_pos.x, tp->t_oldch); /* Move it to the new space */ - tp->t_oldch = mvwinch(cw, y, x); + tp->t_oldch = mvwinch(cw, y, x) & A_CHARTEXT; /* Display the creature if our hero can see it */ if (cansee(y, x) && @@ -109,7 +109,7 @@ tp->t_pos.x = x; /* If the monster is on a trap, trap it */ - rch = mvinch(y, x); + rch = mvinch(y, x) & A_CHARTEXT; if (isatrap(rch)) { if (cansee(y, x)) tp->t_oldch = rch; be_trapped(tp, &(tp->t_pos)); @@ -253,7 +253,7 @@ * Don't look in our spot or where we were. */ if (!ce(tryp, *er) && !ce(tryp, tp->t_oldpos) && - isalpha(mch = mvwinch(mw, y, x))) { + isalpha(mch = mvwinch(mw, y, x) & A_CHARTEXT)) { int test_dist; test_dist = DISTANCE(y, x, ee->y, ee->x); @@ -269,7 +269,7 @@ /* Can we move onto the spot? */ if (!diag_ok(er, &tryp, tp)) continue; - ch = mvwinch(cw, y, x); /* Screen character */ + ch = mvwinch(cw, y, x) & A_CHARTEXT; /* Screen character */ /* * Stepping on player is NOT okay if we are fleeing. @@ -703,13 +703,13 @@ } } - rch = mvwinch(stdscr, old_pos.y, old_pos.x); + rch = mvwinch(stdscr, old_pos.y, old_pos.x) & A_CHARTEXT; if (th->t_oldch == floor && rch != floor && !isatrap(rch)) mvwaddch(cw, old_pos.y, old_pos.x, rch); else mvwaddch(cw, old_pos.y, old_pos.x, th->t_oldch); - sch = mvwinch(cw, ch_ret.y, ch_ret.x); /* What player sees */ - rch = mvwinch(stdscr, ch_ret.y, ch_ret.x); /* What's really there */ + sch = mvwinch(cw, ch_ret.y, ch_ret.x) & A_CHARTEXT; /* What player sees */ + rch = mvwinch(stdscr, ch_ret.y, ch_ret.x) & A_CHARTEXT; /* What's really there */ /* If we have a tunneling monster, it may be making a tunnel */ if (on(*th, CANTUNNEL) && @@ -799,7 +799,7 @@ if (!ce(ch_ret, old_pos)) th->t_oldpos = old_pos; /* If the monster is on a trap, trap it */ - sch = mvinch(ch_ret.y, ch_ret.x); + sch = mvinch(ch_ret.y, ch_ret.x) & A_CHARTEXT; if (isatrap(sch)) { if (cansee(ch_ret.y, ch_ret.x)) th->t_oldch = sch; be_trapped(th, &ch_ret); @@ -907,7 +907,7 @@ ery += dy; erx += dx; while ((ery != eey) || (erx != eex)) { - switch (ch = winat(ery, erx)) { + switch (ch = winat(ery, erx) & A_CHARTEXT) { case VERTWALL: case HORZWALL: case WALL: diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/command.c --- a/xrogue/command.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/command.c Wed Apr 14 18:55:33 2021 -0400 @@ -111,7 +111,7 @@ /* If in a corridor or maze, if we are at a turn with * only one way to go, turn that way. */ - scratch = winat(hero.y, hero.x); + scratch = winat(hero.y, hero.x) & A_CHARTEXT; if ((scratch==PASSAGE||scratch==DOOR||levtype==MAZELEV) && off(player, ISHUH) && off(player, ISBLIND)) { @@ -252,7 +252,7 @@ player.t_action = A_NIL; if (add_pack((struct linked_list *)NULL, FALSE)) { char tch; - tch = mvwinch(stdscr, hero.y, hero.x); + tch = mvwinch(stdscr, hero.y, hero.x) & A_CHARTEXT; if (tch != FLOOR && tch != PASSAGE) { player.t_action = A_PICKUP; /*get more */ player.t_no_move += 2 * movement(&player); @@ -783,9 +783,9 @@ continue; /* Mch and ch will be the same unless there is a monster here */ - mch = winat(y, x); - ch = mvwinch(stdscr, y, x); - sch = mvwinch(cw, y, x); /* What's on the screen */ + mch = winat(y, x) & A_CHARTEXT; + ch = mvwinch(stdscr, y, x) & A_CHARTEXT; + sch = mvwinch(cw, y, x) & A_CHARTEXT; /* What's on the screen */ if (door_chime == FALSE && isatrap(ch)) { register struct trap *tp; @@ -874,7 +874,7 @@ d_level(void) { bool no_phase=FALSE; - char position = winat(hero.y, hero.x); + char position = winat(hero.y, hero.x) & A_CHARTEXT; int au; @@ -977,7 +977,7 @@ { bool no_phase = FALSE; register struct linked_list *item; - char position = winat(hero.y, hero.x); + char position = winat(hero.y, hero.x) & A_CHARTEXT; struct thing *tp; struct object *obj; @@ -1166,7 +1166,7 @@ } 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; } diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/encumb.c --- a/xrogue/encumb.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/encumb.c Wed Apr 14 18:55:33 2021 -0400 @@ -166,7 +166,7 @@ inwhgt = TRUE; if (pstats.s_pack > pstats.s_carry) { - ch = mvwinch(stdscr, hero.y, hero.x); + ch = mvwinch(stdscr, hero.y, hero.x) & A_CHARTEXT; if((ch != FLOOR && ch != PASSAGE)) { extinguish(wghtchk); fuse(wghtchk, NULL, 1, AFTER); diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/fight.c --- a/xrogue/fight.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/fight.c Wed Apr 14 18:55:33 2021 -0400 @@ -541,9 +541,11 @@ } 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()); } diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/io.c --- a/xrogue/io.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/io.c Wed Apr 14 18:55:33 2021 -0400 @@ -167,8 +167,8 @@ unsigned char ch; /* What is here? Don't check monster window if MONSTOK is set */ - if (can_on_monst == MONSTOK) ch = mvinch(y, x); - else ch = winat(y, x); + if (can_on_monst == MONSTOK) ch = mvinch(y, x) & A_CHARTEXT; + else ch = winat(y, x) & A_CHARTEXT; if (can_on_monst == FIGHTOK && isalpha(ch) && (item = find_mons(y, x)) != NULL) { diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/main.c --- a/xrogue/main.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/main.c Wed Apr 14 18:55:33 2021 -0400 @@ -36,7 +36,6 @@ main(int argc, char *argv[], char *envp[]) { register char *env; - time_t now; md_init(); @@ -232,8 +231,7 @@ draw(cw); /* A super wizard doesn't have to get equipped */ /* Check if "" option is TRUE and get environment flag */ - if (wizard && strcmp(getenv("SUPER"),"YES") == 0 || - def_attr == TRUE) { + if ((wizard && strcmp(getenv("SUPER"),"YES") == 0) || def_attr == TRUE) { level = 1; new_level(NORMLEV); } diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/monsters.c --- a/xrogue/monsters.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/monsters.c Wed Apr 14 18:55:33 2021 -0400 @@ -233,7 +233,7 @@ tp->t_dest = NULL; tp->t_name = NULL; tp->t_pos = tp->t_oldpos = *cp; - tp->t_oldch = mvwinch(cw, cp->y, cp->x); + tp->t_oldch = mvwinch(cw, cp->y, cp->x) & A_CHARTEXT; mvwaddch(mw, cp->y, cp->x, tp->t_type); mp = &monsters[tp->t_index]; diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/move.c --- a/xrogue/move.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/move.c Wed Apr 14 18:55:33 2021 -0400 @@ -319,7 +319,7 @@ /* Put it there */ mvwaddch(mw, th->t_pos.y, th->t_pos.x, th->t_type); - 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; /* * check to see if room that creature appears in should * light up @@ -885,7 +885,7 @@ } if (running && ce(hero, move_nh)) after = running = FALSE; - ch = winat(move_nh.y, move_nh.x); + ch = winat(move_nh.y, move_nh.x) & A_CHARTEXT; /* Take care of hero trying to move close to something frightening */ if (on(player, ISFLEE)) { @@ -969,7 +969,7 @@ /* Did we succeed? */ if (ce(tp->t_pos, current)) { /* Reset our idea of what ch is */ - ch = winat(move_nh.y, move_nh.x); + ch = winat(move_nh.y, move_nh.x) & A_CHARTEXT; /* Let it be known that we made the switch */ changed = TRUE; @@ -1140,22 +1140,22 @@ case 'h': case 'l': if (old_hero.y + 1 < lines - 2) { - wall_check = winat(old_hero.y + 1, old_hero.x); + wall_check = winat(old_hero.y + 1, old_hero.x) & A_CHARTEXT; if (!isrock(wall_check)) call_light = TRUE; } if (old_hero.y - 1 > 0) { - wall_check = winat(old_hero.y - 1, old_hero.x); + wall_check = winat(old_hero.y - 1, old_hero.x) & A_CHARTEXT; if (!isrock(wall_check)) call_light = TRUE; } break; case 'j': case 'k': if (old_hero.x + 1 < cols) { - wall_check = winat(old_hero.y, old_hero.x + 1); + wall_check = winat(old_hero.y, old_hero.x + 1) & A_CHARTEXT; if (!isrock(wall_check)) call_light = TRUE; } if (old_hero.x - 1 >= 0) { - wall_check = winat(old_hero.y, old_hero.x - 1); + wall_check = winat(old_hero.y, old_hero.x - 1) & A_CHARTEXT; if (!isrock(wall_check)) call_light = TRUE; } break; @@ -1177,7 +1177,7 @@ if (rp->r_flags & ISTREAS) wake_room(rp); } - ch = winat(old_hero.y, old_hero.x); + ch = winat(old_hero.y, old_hero.x) & A_CHARTEXT; wmove(cw, unc(old_hero)); waddch(cw, ch); wmove(cw, unc(hero)); @@ -1272,9 +1272,9 @@ /* If we are looking at the hero in a rock, broaden our sights */ if (&hero == cp || &player.t_oldpos == cp) { - ch = winat(hero.y, hero.x); + ch = winat(hero.y, hero.x) & A_CHARTEXT; if (isrock(ch)) see_radius = 2; - ch = winat(player.t_oldpos.y, player.t_oldpos.x); + ch = winat(player.t_oldpos.y, player.t_oldpos.x) & A_CHARTEXT; if (isrock(ch)) see_radius = 2; } @@ -1347,7 +1347,7 @@ /* Previously not seen -- now can see it */ if (tp->t_oldch == ' ' && cansee(tp->t_pos.y, tp->t_pos.x)) - tp->t_oldch = mvinch(y, x); + tp->t_oldch = mvinch(y, x) & A_CHARTEXT; /* Previously seen -- now can't see it */ else if (!cansee(tp->t_pos.y, tp->t_pos.x) && @@ -1379,8 +1379,8 @@ on(player, ISBLIND) || (rp->r_flags & FORCEDARK) || (levtype == MAZELEV && !see_here && see_before)) { - sch = mvwinch(cw, y, x); /* What's seen */ - rch = mvinch(y, x); /* What's really there */ + sch = mvwinch(cw, y, x) & A_CHARTEXT; /* What's seen */ + rch = mvinch(y, x) & A_CHARTEXT; /* What's really there */ switch (rch) { case DOOR: case SECRETDOOR: @@ -1598,7 +1598,7 @@ return; } can_traps: - switch (och = mvinch(y, x)) { + switch (och = mvinch(y, x) & A_CHARTEXT) { case WALL: case FLOOR: case PASSAGE: @@ -1775,7 +1775,7 @@ char show(int y, int x) { - register unsigned char ch = winat(y, x); + register unsigned char ch = winat(y, x) & A_CHARTEXT; register struct linked_list *it; register struct thing *tp; @@ -1787,7 +1787,7 @@ 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(mvwinch(stdscr, y, x) & A_CHARTEXT); } tp = THINGPTR(it); @@ -1797,7 +1797,7 @@ else if (invisible(tp)) { /* We can't see surprise-type creatures through "see invisible" */ if (off(player,CANSEE) || on(*tp,CANSURPRISE)) - ch = mvwinch(stdscr, y, x); /* Invisible */ + ch = mvwinch(stdscr, y, x) & A_CHARTEXT; /* Invisible */ } else if (on(*tp, CANINWALL)) { if (isrock(mvwinch(stdscr, y, x))) ch = winch(stdscr); /* As Xorn */ diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/n_level.c --- a/xrogue/n_level.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/n_level.c Wed Apr 14 18:55:33 2021 -0400 @@ -100,22 +100,22 @@ if (vert) for (j=1; jt_pos); } until (cnt++ > 2500 || winat(tp->t_pos.y, tp->t_pos.x) == FLOOR); mvwaddch(mw, tp->t_pos.y, tp->t_pos.x, tp->t_type); - 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; /* * If it has a fire, mark it @@ -335,7 +335,7 @@ nitem = next(item); tp = THINGPTR(item); mvwaddch(mw, tp->t_pos.y, tp->t_pos.x, tp->t_type); - 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; /* * If it has a fire, mark it diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/options.c --- a/xrogue/options.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/options.c Wed Apr 14 18:55:33 2021 -0400 @@ -259,6 +259,7 @@ continue; } else if (sp == buf) + { if (c == '-' && win == hw) /* To move back a line in hw */ break; else if (c == '~') @@ -268,6 +269,7 @@ sp += strlen(home); continue; } + } *sp++ = c; waddstr(win, unctrl(c)); } @@ -320,6 +322,7 @@ retval = (*op->o_getfunc)(op->o_opt, hw); if (retval) + { if (retval == QUIT) break; else if (op > optlist) { /* MINUS */ @@ -332,6 +335,7 @@ wmove(hw, 0, 0); op--; } + } } /* * Switch back to original screen diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/outside.c --- a/xrogue/outside.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/outside.c Wed Apr 14 18:55:33 2021 -0400 @@ -68,7 +68,7 @@ ch = rnd_terrain(); addch(ch); } - else ch = mvinch(basey, basex); + else ch = mvinch(basey, basex) & A_CHARTEXT; curx += deltax; @@ -95,10 +95,10 @@ left_pos = curx - deltax; top_pos = cury - deltay; - left = mvinch(cury, left_pos); - top_left = mvinch(top_pos, left_pos); - top = mvinch(top_pos, curx); - top_right = mvinch(top_pos, curx + deltax); + left = mvinch(cury, left_pos) & A_CHARTEXT; + top_left = mvinch(top_pos, left_pos) & A_CHARTEXT; + top = mvinch(top_pos, curx) & A_CHARTEXT; + top_right = mvinch(top_pos, curx + deltax) & A_CHARTEXT; /* Put the piece of terrain on the map */ mvaddch(cury, curx, get_terrain(left, top_left, top, top_right)); diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/passages.c --- a/xrogue/passages.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/passages.c Wed Apr 14 18:55:33 2021 -0400 @@ -142,7 +142,7 @@ conn(int r1, int r2) { register struct room *rpf, *rpt = NULL; - register char rmt; + register signed char rmt; register int distance = 0, max_diag, offset = 0, i; register int rm; int turns[3], turn_dist[3]; diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/rip.c --- a/xrogue/rip.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/rip.c Wed Apr 14 18:55:33 2021 -0400 @@ -504,7 +504,7 @@ /* 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]", diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/scrolls.c --- a/xrogue/scrolls.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/scrolls.c Wed Apr 14 18:55:33 2021 -0400 @@ -341,7 +341,7 @@ 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 = secretdoor (i, j); diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/state.c --- a/xrogue/state.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/state.c Wed Apr 14 18:55:33 2021 -0400 @@ -3259,8 +3259,8 @@ h = szPath; #endif - if ( (h == NULL) || (*h == '\0') ) - if ( (h = getenv("HOME")) == NULL ) + if ( (h == NULL) || (*h == '\0') ) { + if ( (h = getenv("HOME")) == NULL ) { if ( (h = getenv("HOMEDRIVE")) == NULL) h = ""; else @@ -3271,6 +3271,8 @@ if ( (h = getenv("HOMEPATH")) == NULL) h = ""; } + } + } len = strlen(homedir); @@ -3409,7 +3411,7 @@ */ 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); } diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/sticks.c --- a/xrogue/sticks.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/sticks.c Wed Apr 14 18:55:33 2021 -0400 @@ -269,7 +269,7 @@ mvwaddch(mw, y, x, ' '); mvwaddch(mw, tp->t_pos.y, tp->t_pos.x, tp->t_type); if (tp->t_pos.y != y || tp->t_pos.x != x) - 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; /* * check to see if room that creature appears in should * light up @@ -341,7 +341,7 @@ direction->y += hero.y; direction->x += hero.x; - ch = winat(direction->y, direction->x); + ch = winat(direction->y, direction->x) & A_CHARTEXT; if (isalpha(ch)) { strike = *obj; @@ -550,7 +550,7 @@ for(m2=tp->t_pos.y-1 ; m2<=tp->t_pos.y+1 ; m2++) { if (m1 == hero.x && m2 == hero.y) continue; - ch = winat(m2,m1); + ch = winat(m2,m1) & A_CHARTEXT; if (shoot_ok(ch)) { mp.x = m1; /* create it */ mp.y = m2; diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/things.c --- a/xrogue/things.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/things.c Wed Apr 14 18:55:33 2021 -0400 @@ -395,7 +395,7 @@ } } - switch(ch = mvwinch(stdscr, hero.y, hero.x)) { + switch(ch = mvwinch(stdscr, hero.y, hero.x) & A_CHARTEXT) { case PASSAGE: case SCROLL: case POTION: diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/util.c --- a/xrogue/util.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/util.c Wed Apr 14 18:55:33 2021 -0400 @@ -297,7 +297,7 @@ ret.y < 1 || ret.y > lines - 3) continue; /* off the screen? */ - ch = winat(ret.y, ret.x); + ch = winat(ret.y, ret.x) & A_CHARTEXT; /* * Check to make certain the spot is valid @@ -692,7 +692,7 @@ if (y < 1 || y > lines - 3) continue; /* See what's there -- ignore monsters, just see what they're on */ - savech = mvwinch(mw, y, x); + savech = mvwinch(mw, y, x) & A_CHARTEXT; waddch(mw, ' '); ch = show(y, x); mvwaddch(mw, y, x, savech); /* Restore monster */ @@ -750,7 +750,8 @@ mvwaddch(cw, y, x, in_room ? ' ' : PASSAGE); /* If we found a monster, set it to darkness! */ - if (it) (THINGPTR(it))->t_oldch = mvwinch(cw, y, x); + if (it) (THINGPTR(it))->t_oldch = mvwinch(cw, y, x) & + A_CHARTEXT; } /* Moving out of a corridor? */ @@ -794,7 +795,7 @@ if (it) { tp = THINGPTR(it); - tp->t_oldch = mvinch(y, x); + tp->t_oldch = mvinch(y, x) & A_CHARTEXT; if (isatrap(tp->t_oldch)) { register struct trap *trp = trap_at(y, x); @@ -818,7 +819,7 @@ */ if (off(player, ISBLIND)) { - if (y == hero.y && x == hero.x + if ((y == hero.y && x == hero.x) || (inpass && (ch == HORZWALL || ch == VERTWALL))) continue; @@ -1011,7 +1012,7 @@ msg("Where do you wish to %s to? (* for help) ", action); c = get_coordinates(); mpos = 0; - which = winat(c.y, c.x); + which = winat(c.y, c.x) & A_CHARTEXT; switch (which) { default: if (!isrock(which) || off(player, CANINWALL)) break; @@ -1169,12 +1170,14 @@ cp.y = y; cp.x = x; cpp = &cp; - for (rp = rooms, i = 0; i < MAXROOMS; rp++, i++) - if (inroom(rp, cpp)) + 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(HORZWALL); else return(VERTWALL); + } + } return('p'); } diff -r e06ebc407615 -r e52a8a7ad4c5 xrogue/xcrypt.c --- a/xrogue/xcrypt.c Sat Mar 20 22:36:52 2021 -0400 +++ b/xrogue/xcrypt.c Wed Apr 14 18:55:33 2021 -0400 @@ -598,7 +598,7 @@ if ((*q++ = *key << 1)) key++; } - if (des_setkey((unsigned char *) keybuf)) + if (des_setkey((char *) keybuf)) return(NULL); if (*setting == _PASSWORD_EFMT1) { @@ -617,7 +617,7 @@ /* * 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. @@ -627,7 +627,7 @@ *key) *q++ ^= *key++ << 1; - if (des_setkey((unsigned char *) keybuf)) + if (des_setkey((char *) keybuf)) return(NULL); } strncpy((char *)output, setting, 9);