more warning suppression

This should avoid two of the three bogus clang complaints about
retaining the address of a stack variable after it has gone out of
scope.

Plus a recreation of some formatting I did a while back and then
accidentally clobbered before committing.
This commit is contained in:
PatR
2015-11-20 02:00:31 -08:00
parent d46a80b1c5
commit 3dfc3200dd
4 changed files with 144 additions and 155 deletions
+24 -36
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1446604114 2015/11/04 02:28:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */ /* NetHack 3.6 mkmaze.c $NHDT-Date: 1448013594 2015/11/20 09:59:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -16,14 +16,25 @@ STATIC_DCL boolean FDECL(is_solid, (int, int));
STATIC_DCL int FDECL(extend_spine, (int[3][3], int, int, int)); STATIC_DCL int FDECL(extend_spine, (int[3][3], int, int, int));
STATIC_DCL boolean FDECL(okay, (int, int, int)); STATIC_DCL boolean FDECL(okay, (int, int, int));
STATIC_DCL void FDECL(maze0xy, (coord *)); STATIC_DCL void FDECL(maze0xy, (coord *));
STATIC_DCL boolean STATIC_DCL boolean FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P,
FDECL(put_lregion_here, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
XCHAR_P, BOOLEAN_P, d_level *)); XCHAR_P, BOOLEAN_P, d_level *));
STATIC_DCL void NDECL(fixup_special); STATIC_DCL void NDECL(fixup_special);
STATIC_DCL void FDECL(move, (int *, int *, int));
STATIC_DCL void NDECL(setup_waterlevel); STATIC_DCL void NDECL(setup_waterlevel);
STATIC_DCL void NDECL(unsetup_waterlevel); STATIC_DCL void NDECL(unsetup_waterlevel);
/* adjust a coordinate one step in the specified direction */
#define mz_move(X, Y, dir) \
do { \
switch (dir) { \
case 0: --(Y); break; \
case 1: (X)++; break; \
case 2: (Y)++; break; \
case 3: --(X); break; \
default: panic("mz_move: bad direction %d", dir); \
} \
} while (0)
STATIC_OVL boolean STATIC_OVL boolean
iswall(x, y) iswall(x, y)
int x, y; int x, y;
@@ -195,8 +206,8 @@ okay(x, y, dir)
int x, y; int x, y;
register int dir; register int dir;
{ {
move(&x, &y, dir); mz_move(x, y, dir);
move(&x, &y, dir); mz_move(x, y, dir);
if (x < 3 || y < 3 || x > x_maze_max || y > y_maze_max if (x < 3 || y < 3 || x > x_maze_max || y > y_maze_max
|| levl[x][y].typ != 0) || levl[x][y].typ != 0)
return FALSE; return FALSE;
@@ -697,9 +708,9 @@ schar typ;
pos--; pos--;
else { else {
dir = dirs[rn2(q)]; dir = dirs[rn2(q)];
move(&x, &y, dir); mz_move(x, y, dir);
levl[x][y].typ = typ; levl[x][y].typ = typ;
move(&x, &y, dir); mz_move(x, y, dir);
pos++; pos++;
if (pos > CELLS) if (pos > CELLS)
panic("Overflow in walkfrom"); panic("Overflow in walkfrom");
@@ -708,7 +719,7 @@ schar typ;
} }
} }
} }
#else #else /* !MICRO */
void void
walkfrom(x, y, typ) walkfrom(x, y, typ)
@@ -739,36 +750,13 @@ schar typ;
if (!q) if (!q)
return; return;
dir = dirs[rn2(q)]; dir = dirs[rn2(q)];
move(&x, &y, dir); mz_move(x, y, dir);
levl[x][y].typ = typ; levl[x][y].typ = typ;
move(&x, &y, dir); mz_move(x, y, dir);
walkfrom(x, y, typ); walkfrom(x, y, typ);
} }
} }
#endif /* MICRO */ #endif /* ?MICRO */
STATIC_OVL void
move(x, y, dir)
register int *x, *y;
register int dir;
{
switch (dir) {
case 0:
--(*y);
break;
case 1:
(*x)++;
break;
case 2:
(*y)++;
break;
case 3:
--(*x);
break;
default:
panic("move: bad direction");
}
}
/* find random point in generated corridors, /* find random point in generated corridors,
so we don't create items in moats, bunkers, or walls */ so we don't create items in moats, bunkers, or walls */
+17 -15
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 topten.c $NHDT-Date: 1446887536 2015/11/07 09:12:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */ /* NetHack 3.6 topten.c $NHDT-Date: 1448013597 2015/11/20 09:59:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -103,12 +103,12 @@ int how;
switch (killer.format) { switch (killer.format) {
default: default:
impossible("bad killer format? (%d)", killer.format); impossible("bad killer format? (%d)", killer.format);
/*FALLTHRU*/ /*FALLTHRU*/
case NO_KILLER_PREFIX: case NO_KILLER_PREFIX:
break; break;
case KILLED_BY_AN: case KILLED_BY_AN:
kname = an(kname); kname = an(kname);
/*FALLTHRU*/ /*FALLTHRU*/
case KILLED_BY: case KILLED_BY:
(void) strncat(buf, killed_by_prefix[how], siz - 1); (void) strncat(buf, killed_by_prefix[how], siz - 1);
l = strlen(buf); l = strlen(buf);
@@ -325,7 +325,8 @@ struct toptenentry *tt;
buf, /* (already includes separator) */ buf, /* (already includes separator) */
XLOG_SEP, plname, XLOG_SEP, tt->death); XLOG_SEP, plname, XLOG_SEP, tt->death);
if (multi) if (multi)
Fprintf(rfile, "%cwhile=%s", XLOG_SEP, multi_reason ? multi_reason : "helpless"); Fprintf(rfile, "%cwhile=%s", XLOG_SEP,
multi_reason ? multi_reason : "helpless");
Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP, Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP,
encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve()); encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve());
Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP, Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP,
@@ -458,11 +459,11 @@ time_t when;
FILE *xlfile; FILE *xlfile;
#endif /* XLOGFILE */ #endif /* XLOGFILE */
/* Under DICE 3.0, this crashes the system consistently, apparently due to
* corruption of *rfile somewhere. Until I figure this out, just cut out
* topten support entirely - at least then the game exits cleanly. --AC
*/
#ifdef _DCC #ifdef _DCC
/* Under DICE 3.0, this crashes the system consistently, apparently due to
* corruption of *rfile somewhere. Until I figure this out, just cut out
* topten support entirely - at least then the game exits cleanly. --AC
*/
return; return;
#endif #endif
@@ -489,17 +490,17 @@ time_t when;
/* create a new 'topten' entry */ /* create a new 'topten' entry */
t0_used = FALSE; t0_used = FALSE;
t0 = newttentry(); t0 = newttentry();
t0->ver_major = VERSION_MAJOR;
t0->ver_minor = VERSION_MINOR;
t0->patchlevel = PATCHLEVEL;
t0->points = u.urexp;
t0->deathdnum = u.uz.dnum;
/* deepest_lev_reached() is in terms of depth(), and reporting the /* deepest_lev_reached() is in terms of depth(), and reporting the
* deepest level reached in the dungeon death occurred in doesn't * deepest level reached in the dungeon death occurred in doesn't
* seem right, so we have to report the death level in depth() terms * seem right, so we have to report the death level in depth() terms
* as well (which also seems reasonable since that's all the player * as well (which also seems reasonable since that's all the player
* sees on the screen anyway) * sees on the screen anyway)
*/ */
t0->ver_major = VERSION_MAJOR;
t0->ver_minor = VERSION_MINOR;
t0->patchlevel = PATCHLEVEL;
t0->points = u.urexp;
t0->deathdnum = u.uz.dnum;
t0->deathlev = observable_depth(&u.uz); t0->deathlev = observable_depth(&u.uz);
t0->maxlvl = deepest_lev_reached(TRUE); t0->maxlvl = deepest_lev_reached(TRUE);
t0->hp = u.uhp; t0->hp = u.uhp;
@@ -545,8 +546,7 @@ time_t when;
if (wizard || discover) { if (wizard || discover) {
if (how != PANICKED) if (how != PANICKED)
HUP HUP {
{
char pbuf[BUFSZ]; char pbuf[BUFSZ];
topten_print(""); topten_print("");
Sprintf(pbuf, Sprintf(pbuf,
@@ -711,6 +711,7 @@ time_t when;
t1->ver_major = t1->ver_minor = t1->patchlevel = 0; t1->ver_major = t1->ver_minor = t1->patchlevel = 0;
t1->uid = t1->deathdnum = t1->deathlev = 0; t1->uid = t1->deathdnum = t1->deathlev = 0;
t1->maxlvl = t1->hp = t1->maxhp = t1->deaths = 0; t1->maxlvl = t1->hp = t1->maxhp = t1->deaths = 0;
t1->uid = 0;
t1->plrole[0] = t1->plrace[0] = t1->plgend[0] = t1->plalign[0] = '-'; t1->plrole[0] = t1->plrace[0] = t1->plgend[0] = t1->plalign[0] = '-';
t1->plrole[1] = t1->plrace[1] = t1->plgend[1] = t1->plalign[1] = 0; t1->plrole[1] = t1->plrace[1] = t1->plgend[1] = t1->plalign[1] = 0;
t1->birthdate = t1->deathdate = yyyymmdd((time_t) 0L); t1->birthdate = t1->deathdate = yyyymmdd((time_t) 0L);
@@ -989,6 +990,7 @@ char **argv;
#ifdef AMIGA #ifdef AMIGA
{ {
extern winid amii_rawprwin; extern winid amii_rawprwin;
init_nhwindows(&argc, argv); init_nhwindows(&argc, argv);
amii_rawprwin = create_nhwindow(NHW_TEXT); amii_rawprwin = create_nhwindow(NHW_TEXT);
} }
+50 -54
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 vision.c $NHDT-Date: 1446861773 2015/11/07 02:02:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */ /* NetHack 3.6 vision.c $NHDT-Date: 1448013598 2015/11/20 09:59:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */ /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -65,7 +65,7 @@ char circle_start[] = {
/*15*/ 119, /*15*/ 119,
}; };
/*===========================================================================*/ /*==========================================================================*/
/* Vision (arbitrary line of sight) /* Vision (arbitrary line of sight)
* =========================================*/ * =========================================*/
@@ -97,9 +97,9 @@ static char right_ptrs[ROWNO][COLNO];
STATIC_DCL void FDECL(fill_point, (int, int)); STATIC_DCL void FDECL(fill_point, (int, int));
STATIC_DCL void FDECL(dig_point, (int, int)); STATIC_DCL void FDECL(dig_point, (int, int));
STATIC_DCL void NDECL(view_init); STATIC_DCL void NDECL(view_init);
STATIC_DCL void FDECL(view_from, STATIC_DCL void FDECL(view_from, (int, int, char **, char *, char *, int,
(int, int, char **, char *, char *, int, void (*)(int, int, genericptr_t),
void (*)(int, int, genericptr_t), genericptr_t)); genericptr_t));
STATIC_DCL void FDECL(get_unused_cs, (char ***, char **, char **)); STATIC_DCL void FDECL(get_unused_cs, (char ***, char **, char **));
STATIC_DCL void FDECL(rogue_vision, (char **, char *, char *)); STATIC_DCL void FDECL(rogue_vision, (char **, char *, char *));
@@ -140,8 +140,8 @@ vision_init()
#ifdef VISION_TABLES #ifdef VISION_TABLES
/* Note: this initializer doesn't do anything except guarantee that /* Note: this initializer doesn't do anything except guarantee that
we're linked properly. * we're linked properly.
*/ */
vis_tab_init(); vis_tab_init();
#endif #endif
} }
@@ -349,7 +349,7 @@ char *rmin, *rmax;
} }
} }
/*#define EXTEND_SPINE*/ /* possibly better looking wall-angle */ /*#define EXTEND_SPINE*/ /* possibly better looking wall-angle */
#ifdef EXTEND_SPINE #ifdef EXTEND_SPINE
@@ -534,7 +534,7 @@ int control;
/* You see nothing, nothing can see you --- if swallowed or refreshing. */ /* You see nothing, nothing can see you --- if swallowed or refreshing. */
if (u.uswallow || control == 2) { if (u.uswallow || control == 2) {
/* do nothing -- get_unused_cs() nulls out the new work area */ /* do nothing -- get_unused_cs() nulls out the new work area */
;
} else if (Blind) { } else if (Blind) {
/* /*
* Calculate the could_see array even when blind so that monsters * Calculate the could_see array even when blind so that monsters
@@ -594,10 +594,9 @@ int control;
next_rmax[row] = max(next_rmax[row], col); next_rmax[row] = max(next_rmax[row], col);
next_array[row][col] = IN_SIGHT | COULD_SEE; next_array[row][col] = IN_SIGHT | COULD_SEE;
} }
}
/* if in a pit, just update for immediate locations */ /* if in a pit, just update for immediate locations */
else if (u.utrap && u.utraptype == TT_PIT) { } else if (u.utrap && u.utraptype == TT_PIT) {
for (row = u.uy - 1; row <= u.uy + 1; row++) { for (row = u.uy - 1; row <= u.uy + 1; row++) {
if (row < 0) if (row < 0)
continue; continue;
@@ -741,9 +740,8 @@ int control;
/* Update pos if previously not in sight or new angle. */ /* Update pos if previously not in sight or new angle. */
if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv) if (!(old_row[col] & IN_SIGHT) || oldseenv != lev->seenv)
newsym(col, row); newsym(col, row);
}
else if ((next_row[col] & COULD_SEE) } else if ((next_row[col] & COULD_SEE)
&& (lev->lit || (next_row[col] & TEMP_LIT))) { && (lev->lit || (next_row[col] & TEMP_LIT))) {
/* /*
* We see this position because it is lit. * We see this position because it is lit.
@@ -795,7 +793,7 @@ int control;
*/ */
lev->waslit = 0; /* remember lit condition */ lev->waslit = 0; /* remember lit condition */
newsym(col, row); newsym(col, row);
}
/* /*
* At this point we know that the row position is *not* in normal * At this point we know that the row position is *not* in normal
* sight. That is, the position is could be seen, but is dark * sight. That is, the position is could be seen, but is dark
@@ -806,10 +804,10 @@ int control;
* the glyph -- E.g. darken room spot, etc. * the glyph -- E.g. darken room spot, etc.
* o If we now could see the location (yet the location is not * o If we now could see the location (yet the location is not
* lit), but previously we couldn't see the location, or vice * lit), but previously we couldn't see the location, or vice
* versa. Update the spot because there there may be an infrared * versa. Update the spot because there there may be an
* monster there. * infrared monster there.
*/ */
else { } else {
not_in_sight: not_in_sight:
if ((old_row[col] & IN_SIGHT) if ((old_row[col] & IN_SIGHT)
|| ((next_row[col] & COULD_SEE) || ((next_row[col] & COULD_SEE)
@@ -878,17 +876,17 @@ int x, y;
vision_full_recalc = 1; vision_full_recalc = 1;
} }
/*===========================================================================*\ /*==========================================================================*\
| | | |
| Everything below this line uses (y,x) instead of (x,y) --- the | | Everything below this line uses (y,x) instead of (x,y) --- the |
| algorithms are faster if they are less recursive and can scan | | algorithms are faster if they are less recursive and can scan |
| on a row longer. | | on a row longer. |
| | | |
\*===========================================================================*/ \*==========================================================================*/
/* ======================================================================== *\ /* ======================================================================= *\
Left and Right Pointer Updates Left and Right Pointer Updates
\* ======================================================================== */ \* ======================================================================= */
/* /*
* LEFT and RIGHT pointer rules * LEFT and RIGHT pointer rules
@@ -956,12 +954,11 @@ int row, col;
for (i = left_ptrs[row][COLNO - 2]; i < COLNO - 1; i++) for (i = left_ptrs[row][COLNO - 2]; i < COLNO - 1; i++)
right_ptrs[row][i] = COLNO - 2; right_ptrs[row][i] = COLNO - 2;
} }
}
/* /*
* At this point, we know we aren't on the boundaries. * At this point, we know we aren't on the boundaries.
*/ */
else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) { } else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) {
/* Both sides clear */ /* Both sides clear */
for (i = left_ptrs[row][col - 1]; i <= col; i++) { for (i = left_ptrs[row][col - 1]; i <= col; i++) {
if (!viz_clear[row][i]) if (!viz_clear[row][i])
@@ -1038,12 +1035,11 @@ int row, col;
for (i = left_ptrs[row][COLNO - 2]; i < COLNO - 1; i++) for (i = left_ptrs[row][COLNO - 2]; i < COLNO - 1; i++)
right_ptrs[row][i] = COLNO - 1; right_ptrs[row][i] = COLNO - 1;
} }
}
/* /*
* Else we know that we are not on an edge. * Else we know that we are not on an edge.
*/ */
else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) { } else if (viz_clear[row][col - 1] && viz_clear[row][col + 1]) {
/* Both sides clear */ /* Both sides clear */
for (i = left_ptrs[row][col - 1] + 1; i <= col; i++) for (i = left_ptrs[row][col - 1] + 1; i <= col; i++)
right_ptrs[row][i] = col; right_ptrs[row][i] = col;
@@ -1093,8 +1089,8 @@ int row, col;
} }
} }
/*===========================================================================*/ /*==========================================================================*/
/*===========================================================================*/ /*==========================================================================*/
/* Use either algorithm C or D. See the config.h for more details. /* Use either algorithm C or D. See the config.h for more details.
* =========*/ * =========*/
@@ -1355,7 +1351,7 @@ static genericptr_t varg;
result = 1; \ result = 1; \
} }
#else /* quadrants are really functions */ #else /* !MACRO_CPATH -- quadrants are really functions */
STATIC_DCL int FDECL(_q1_path, (int, int, int, int)); STATIC_DCL int FDECL(_q1_path, (int, int, int, int));
STATIC_DCL int FDECL(_q2_path, (int, int, int, int)); STATIC_DCL int FDECL(_q2_path, (int, int, int, int));
@@ -1559,7 +1555,7 @@ int scol, srow, y2, x2;
return 1; return 1;
} }
#endif /* quadrants are functions */ #endif /* ?MACRO_CPATH */
/* /*
* Use vision tables to determine if there is a clear path from * Use vision tables to determine if there is a clear path from
@@ -1596,10 +1592,10 @@ cleardone:
} }
#ifdef VISION_TABLES #ifdef VISION_TABLES
/*===========================================================================*\ /*==========================================================================*\
GENERAL LINE OF SIGHT GENERAL LINE OF SIGHT
Algorithm D Algorithm D
\*===========================================================================*/ \*==========================================================================*/
/* /*
* Indicate caller for the shadow routines. * Indicate caller for the shadow routines.
@@ -1616,8 +1612,8 @@ cleardone:
static close2d *close_dy[CLOSE_MAX_BC_DY]; static close2d *close_dy[CLOSE_MAX_BC_DY];
static far2d *far_dy[FAR_MAX_BC_DY]; static far2d *far_dy[FAR_MAX_BC_DY];
STATIC_DCL void FDECL(right_side, STATIC_DCL void FDECL(right_side, (int, int, int, int, int,
(int, int, int, int, int, int, int, char *)); int, int, char *));
STATIC_DCL void FDECL(left_side, (int, int, int, int, int, int, int, char *)); STATIC_DCL void FDECL(left_side, (int, int, int, int, int, int, int, char *));
STATIC_DCL int FDECL(close_shadow, (int, int, int, int)); STATIC_DCL int FDECL(close_shadow, (int, int, int, int));
STATIC_DCL int FDECL(far_shadow, (int, int, int, int)); STATIC_DCL int FDECL(far_shadow, (int, int, int, int));
@@ -1966,12 +1962,12 @@ char *limits; /* points at range limit for current row, or NULL */
hit_stone = 1; hit_stone = 1;
left = loc_right + 1; left = loc_right + 1;
}
/* /*
* The opening extends beyond the right mark. This means that * The opening extends beyond the right mark. This means that
* the next far block is the current far block. * the next far block is the current far block.
*/ */
else { } else {
if (vis_func) { if (vis_func) {
for (i = left; i <= right_shadow; i++) for (i = left; i <= right_shadow; i++)
(*vis_func)(i, row, varg); (*vis_func)(i, row, varg);
@@ -2169,9 +2165,9 @@ char *limits;
hit_stone = 1; /* needed for walls of width 1 */ hit_stone = 1; /* needed for walls of width 1 */
right = loc_left - 1; right = loc_left - 1;
}
/* The opening extends beyond the left mark. */ /* The opening extends beyond the left mark. */
else { } else {
if (vis_func) { if (vis_func) {
for (i = left_shadow; i <= right; i++) for (i = left_shadow; i <= right; i++)
(*vis_func)(i, row, varg); (*vis_func)(i, row, varg);
@@ -2292,10 +2288,10 @@ genericptr_t arg;
#else /*===== End of algorithm D =====*/ #else /*===== End of algorithm D =====*/
/*===========================================================================*\ /*==========================================================================*\
GENERAL LINE OF SIGHT GENERAL LINE OF SIGHT
Algorithm C Algorithm C
\*===========================================================================*/ \*==========================================================================*/
/* /*
* Defines local to Algorithm C. * Defines local to Algorithm C.
@@ -2418,9 +2414,9 @@ char *limits; /* points at range limit for current row, or NULL */
if (left > lim_max) if (left > lim_max)
return; /* check (1) */ return; /* check (1) */
if (left == lim_max) { /* check (2) */ if (left == lim_max) { /* check (2) */
if (vis_func) if (vis_func) {
(*vis_func)(lim_max, row, varg); (*vis_func)(lim_max, row, varg);
else { } else {
set_cs(rowp, lim_max); set_cs(rowp, lim_max);
set_max(lim_max); set_max(lim_max);
} }
@@ -2483,10 +2479,10 @@ char *limits; /* points at range limit for current row, or NULL */
if (right > lim_max) if (right > lim_max)
right = lim_max; right = lim_max;
/* set the bits */ /* set the bits */
if (vis_func) if (vis_func) {
for (i = left; i <= right; i++) for (i = left; i <= right; i++)
(*vis_func)(i, row, varg); (*vis_func)(i, row, varg);
else { } else {
for (i = left; i <= right; i++) for (i = left; i <= right; i++)
set_cs(rowp, i); set_cs(rowp, i);
set_min(left); set_min(left);
@@ -2579,9 +2575,9 @@ char *limits;
if (right < lim_min) if (right < lim_min)
return; return;
if (right == lim_min) { if (right == lim_min) {
if (vis_func) if (vis_func) {
(*vis_func)(lim_min, row, varg); (*vis_func)(lim_min, row, varg);
else { } else {
set_cs(rowp, lim_min); set_cs(rowp, lim_min);
set_min(lim_min); set_min(lim_min);
} }
@@ -2618,10 +2614,10 @@ char *limits;
if (left < lim_min) if (left < lim_min)
left = lim_min; left = lim_min;
if (vis_func) if (vis_func) {
for (i = left; i <= right; i++) for (i = left; i <= right; i++)
(*vis_func)(i, row, varg); (*vis_func)(i, row, varg);
else { } else {
for (i = left; i <= right; i++) for (i = left; i <= right; i++)
set_cs(rowp, i); set_cs(rowp, i);
set_min(left); set_min(left);
@@ -2754,10 +2750,10 @@ void FDECL((*func), (int, int, genericptr_t));
genericptr_t arg; genericptr_t arg;
{ {
/* If not centered on hero, do the hard work of figuring the area */ /* If not centered on hero, do the hard work of figuring the area */
if (scol != u.ux || srow != u.uy) if (scol != u.ux || srow != u.uy) {
view_from(srow, scol, (char **) 0, (char *) 0, (char *) 0, range, view_from(srow, scol, (char **) 0, (char *) 0, (char *) 0, range,
func, arg); func, arg);
else { } else {
register int x; register int x;
int y, min_x, max_x, max_y, offset; int y, min_x, max_x, max_y, offset;
char *limits; char *limits;
+53 -50
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 windows.c $NHDT-Date: 1433806591 2015/06/08 23:36:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ /* NetHack 3.6 windows.c $NHDT-Date: 1448013599 2015/11/20 09:59:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */
/* Copyright (c) D. Cohrs, 1993. */ /* Copyright (c) D. Cohrs, 1993. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -7,8 +7,8 @@
#include "wintty.h" #include "wintty.h"
#endif #endif
#ifdef X11_GRAPHICS #ifdef X11_GRAPHICS
/* cannot just blindly include winX.h without including all of X11 stuff */ /* Cannot just blindly include winX.h without including all of X11 stuff
/* and must get the order of include files right. Don't bother */ and must get the order of include files right. Don't bother. */
extern struct window_procs X11_procs; extern struct window_procs X11_procs;
extern void FDECL(win_X11_init, (int)); extern void FDECL(win_X11_init, (int));
#endif #endif
@@ -27,7 +27,7 @@ extern void FDECL(be_win_init, (int));
FAIL /* be_win_init doesn't exist? XXX*/ FAIL /* be_win_init doesn't exist? XXX*/
#endif #endif
#ifdef AMIGA_INTUITION #ifdef AMIGA_INTUITION
extern struct window_procs amii_procs; extern struct window_procs amii_procs;
extern struct window_procs amiv_procs; extern struct window_procs amiv_procs;
extern void FDECL(ami_wininit_data, (int)); extern void FDECL(ami_wininit_data, (int));
#endif #endif
@@ -155,7 +155,7 @@ wl_addtail(struct winlink *wl)
p->nextlink = wl; p->nextlink = wl;
return; return;
} }
#endif #endif /* WINCHAIN */
static struct win_choices *last_winchoice = 0; static struct win_choices *last_winchoice = 0;
@@ -191,8 +191,7 @@ const char *s;
return &winchoices[i]; return &winchoices[i];
} }
} }
return (struct win_choices *) 0;
return NULL;
} }
#endif #endif
@@ -348,7 +347,7 @@ commit_windowchain()
p = np; /* assignment, not proof */ p = np; /* assignment, not proof */
} }
} }
#endif #endif /* WINCHAIN */
/* /*
* tty_message_menu() provides a means to get feedback from the * tty_message_menu() provides a means to get feedback from the
@@ -401,23 +400,24 @@ genl_putmsghistory(msg, is_restoring)
const char *msg; const char *msg;
boolean is_restoring; boolean is_restoring;
{ {
/* window ports can provide /* window ports can provide
their own putmsghistory() routine to their own putmsghistory() routine to
load message history from a saved game. load message history from a saved game.
The routine is called repeatedly from The routine is called repeatedly from
the core restore routine, starting with the core restore routine, starting with
the oldest saved message first, and the oldest saved message first, and
finishing with the latest. finishing with the latest.
The window port routine is expected to The window port routine is expected to
load the message recall buffers in such load the message recall buffers in such
a way that the ordering is preserved. a way that the ordering is preserved.
The window port routine should make no The window port routine should make no
assumptions about how many messages are assumptions about how many messages are
forthcoming, nor should it assume that forthcoming, nor should it assume that
another message will follow this one, another message will follow this one,
so it should keep all pointers/indexes so it should keep all pointers/indexes
intact at the end of each call. intact at the end of each call.
*/ */
/* this doesn't provide for reloading the message window with the /* this doesn't provide for reloading the message window with the
previous session's messages upon restore, but it does put the quest previous session's messages upon restore, but it does put the quest
message summary lines there by treating them as ordinary messages */ message summary lines there by treating them as ordinary messages */
@@ -470,7 +470,8 @@ static void FDECL(hup_void_fdecl_winid, (winid));
static void FDECL(hup_void_fdecl_constchar_p, (const char *)); static void FDECL(hup_void_fdecl_constchar_p, (const char *));
static struct window_procs hup_procs = { static struct window_procs hup_procs = {
"hup", 0L, 0L, hup_init_nhwindows, hup_void_ndecl, /* player_selection */ "hup", 0L, 0L, hup_init_nhwindows,
hup_void_ndecl, /* player_selection */
hup_void_ndecl, /* askname */ hup_void_ndecl, /* askname */
hup_void_ndecl, /* get_nh_event */ hup_void_ndecl, /* get_nh_event */
hup_exit_nhwindows, hup_void_fdecl_constchar_p, /* suspend_nhwindows */ hup_exit_nhwindows, hup_void_fdecl_constchar_p, /* suspend_nhwindows */
@@ -480,39 +481,39 @@ static struct window_procs hup_procs = {
hup_curs, hup_putstr, hup_putstr, /* putmixed */ hup_curs, hup_putstr, hup_putstr, /* putmixed */
hup_display_file, hup_void_fdecl_winid, /* start_menu */ hup_display_file, hup_void_fdecl_winid, /* start_menu */
hup_add_menu, hup_end_menu, hup_select_menu, genl_message_menu, hup_add_menu, hup_end_menu, hup_select_menu, genl_message_menu,
hup_void_ndecl, /* update_inventory */ hup_void_ndecl, /* update_inventory */
hup_void_ndecl, /* mark_synch */ hup_void_ndecl, /* mark_synch */
hup_void_ndecl, /* wait_synch */ hup_void_ndecl, /* wait_synch */
#ifdef CLIPPING #ifdef CLIPPING
hup_cliparound, hup_cliparound,
#endif #endif
#ifdef POSITIONBAR #ifdef POSITIONBAR
(void FDECL( (void FDECL((*), (char *))) hup_void_fdecl_constchar_p,
(*), (char *))) hup_void_fdecl_constchar_p, /* update_positionbar */ /* update_positionbar */
#endif #endif
hup_print_glyph, hup_print_glyph,
hup_void_fdecl_constchar_p, /* raw_print */ hup_void_fdecl_constchar_p, /* raw_print */
hup_void_fdecl_constchar_p, /* raw_print_bold */ hup_void_fdecl_constchar_p, /* raw_print_bold */
hup_nhgetch, hup_nh_poskey, hup_void_ndecl, /* nhbell */ hup_nhgetch, hup_nh_poskey, hup_void_ndecl, /* nhbell */
hup_int_ndecl, /* doprev_message */ hup_int_ndecl, /* doprev_message */
hup_yn_function, hup_getlin, hup_int_ndecl, /* get_ext_cmd */ hup_yn_function, hup_getlin, hup_int_ndecl, /* get_ext_cmd */
hup_void_fdecl_int, /* number_pad */ hup_void_fdecl_int, /* number_pad */
hup_void_ndecl, /* delay_output */ hup_void_ndecl, /* delay_output */
#ifdef CHANGE_COLOR #ifdef CHANGE_COLOR
hup_change_color, hup_change_color,
#ifdef MAC #ifdef MAC
hup_void_fdecl_int, /* change_background */ hup_void_fdecl_int, /* change_background */
hup_set_font_name, hup_set_font_name,
#endif #endif
hup_get_color_string, hup_get_color_string,
#endif /* CHANGE_COLOR */ #endif /* CHANGE_COLOR */
hup_void_ndecl, /* start_screen */ hup_void_ndecl, /* start_screen */
hup_void_ndecl, /* end_screen */ hup_void_ndecl, /* end_screen */
hup_outrip, genl_preference_update, genl_getmsghistory, hup_outrip, genl_preference_update, genl_getmsghistory,
genl_putmsghistory, genl_putmsghistory,
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
hup_void_ndecl, /* status_init */ hup_void_ndecl, /* status_init */
hup_void_ndecl, /* status_finish */ hup_void_ndecl, /* status_finish */
genl_status_enablefield, hup_status_update, genl_status_enablefield, hup_status_update,
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
genl_status_threshold, genl_status_threshold,
@@ -801,9 +802,9 @@ const char *string UNUSED;
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
/*****************************************************************************/ /****************************************************************************/
/* genl backward compat stuff */ /* genl backward compat stuff */
/*****************************************************************************/ /****************************************************************************/
const char *status_fieldnm[MAXBLSTATS]; const char *status_fieldnm[MAXBLSTATS];
const char *status_fieldfmt[MAXBLSTATS]; const char *status_fieldfmt[MAXBLSTATS];
@@ -864,10 +865,11 @@ genericptr_t ptr;
enum statusfields fieldorder[2][15] = { enum statusfields fieldorder[2][15] = {
{ BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN, { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH}, BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
BL_FLUSH },
{ BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX, { BL_LEVELDESC, BL_GOLD, BL_HP, BL_HPMAX, BL_ENE, BL_ENEMAX,
BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER, BL_AC, BL_XP, BL_EXP, BL_HD, BL_TIME, BL_HUNGER,
BL_CAP, BL_CONDITION, BL_FLUSH} BL_CAP, BL_CONDITION, BL_FLUSH }
}; };
if (idx != BL_FLUSH) { if (idx != BL_FLUSH) {
@@ -893,7 +895,8 @@ genericptr_t ptr;
Strcat(status_vals[idx], " Slime"); Strcat(status_vals[idx], " Slime");
break; break;
default: default:
Sprintf(status_vals[idx], status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text); Sprintf(status_vals[idx],
status_fieldfmt[idx] ? status_fieldfmt[idx] : "%s", text);
break; break;
} }
} }