Merge branch 'NetHack-3.6.2'
This commit is contained in:
46
src/sp_lev.c
46
src/sp_lev.c
@@ -126,6 +126,8 @@ STATIC_DCL int FDECL(selection_rndcoord, (struct opvar *, schar *, schar *,
|
||||
STATIC_DCL void FDECL(selection_do_grow, (struct opvar *, int));
|
||||
STATIC_DCL int FDECL(floodfillchk_match_under, (int, int));
|
||||
STATIC_DCL int FDECL(floodfillchk_match_accessible, (int, int));
|
||||
STATIC_DCL boolean FDECL(sel_flood_havepoint, (int, int,
|
||||
xchar *, xchar *, int));
|
||||
STATIC_DCL void FDECL(selection_do_ellipse, (struct opvar *, int, int,
|
||||
int, int, int));
|
||||
STATIC_DCL long FDECL(line_dist_coord, (long, long, long, long, long, long));
|
||||
@@ -2550,21 +2552,29 @@ region *tmpregion;
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
/* initialization common to all special levels */
|
||||
/* XXX dup name in mkmap.c */
|
||||
void
|
||||
=======
|
||||
STATIC_OVL void
|
||||
>>>>>>> NetHack-3.6.2
|
||||
wallify_map(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
int x, y, xx, yy, lo_xx, lo_yy, hi_xx, hi_yy;
|
||||
|
||||
y1 = max(y1, 0);
|
||||
x1 = max(x1, 1);
|
||||
y2 = min(y2, ROWNO - 1);
|
||||
x2 = min(x2, COLNO - 1);
|
||||
for (y = y1; y <= y2; y++) {
|
||||
lo_yy = (y > 0) ? y - 1 : 0;
|
||||
hi_yy = (y < y2) ? y + 1 : y2;
|
||||
for (x = x1; x <= x2; x++) {
|
||||
if (levl[x][y].typ != STONE)
|
||||
continue;
|
||||
lo_xx = (x > 0) ? x - 1 : 0;
|
||||
lo_xx = (x > 1) ? x - 1 : 1;
|
||||
hi_xx = (x < x2) ? x + 1 : x2;
|
||||
for (yy = lo_yy; yy <= hi_yy; yy++)
|
||||
for (xx = lo_xx; xx <= hi_xx; xx++)
|
||||
@@ -3901,6 +3911,23 @@ int x, y;
|
||||
|| levl[x][y].typ == SCORR);
|
||||
}
|
||||
|
||||
/* check whethere <x,y> is already in xs[],ys[] */
|
||||
STATIC_OVL boolean
|
||||
sel_flood_havepoint(x, y, xs, ys, n)
|
||||
int x, y;
|
||||
xchar xs[], ys[];
|
||||
int n;
|
||||
{
|
||||
xchar xx = (xchar) x, yy = (xchar) y;
|
||||
|
||||
while (n > 0) {
|
||||
if (xs[n] == xx && ys[n] == yy)
|
||||
return TRUE;
|
||||
--n;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
selection_floodfill(ov, x, y, diagonals)
|
||||
struct opvar *ov;
|
||||
@@ -3910,7 +3937,7 @@ boolean diagonals;
|
||||
static const char nhFunc[] = "selection_floodfill";
|
||||
struct opvar *tmp = selection_opvar((char *) 0);
|
||||
#define SEL_FLOOD_STACK (COLNO * ROWNO)
|
||||
#define SEL_FLOOD(nx, ny) \
|
||||
#define SEL_FLOOD(nx, ny) \
|
||||
do { \
|
||||
if (idx < SEL_FLOOD_STACK) { \
|
||||
dx[idx] = (nx); \
|
||||
@@ -3919,17 +3946,20 @@ boolean diagonals;
|
||||
} else \
|
||||
panic(floodfill_stack_overrun); \
|
||||
} while (0)
|
||||
#define SEL_FLOOD_CHKDIR(mx,my,sel) \
|
||||
if (isok((mx), (my)) \
|
||||
&& (*selection_flood_check_func)((mx), (my)) \
|
||||
&& !selection_getpoint((mx), (my), (sel))) \
|
||||
SEL_FLOOD((mx), (my))
|
||||
#define SEL_FLOOD_CHKDIR(mx, my, sel) \
|
||||
do { \
|
||||
if (isok((mx), (my)) \
|
||||
&& (*selection_flood_check_func)((mx), (my)) \
|
||||
&& !selection_getpoint((mx), (my), (sel)) \
|
||||
&& !sel_flood_havepoint((mx), (my), dx, dy, idx)) \
|
||||
SEL_FLOOD((mx), (my)); \
|
||||
} while (0)
|
||||
static const char floodfill_stack_overrun[] = "floodfill stack overrun";
|
||||
int idx = 0;
|
||||
xchar dx[SEL_FLOOD_STACK];
|
||||
xchar dy[SEL_FLOOD_STACK];
|
||||
|
||||
if (selection_flood_check_func == NULL) {
|
||||
if (selection_flood_check_func == (int FDECL((*), (int, int))) 0) {
|
||||
opvar_free(tmp);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user