Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2018-08-16 08:01:22 -04:00
5 changed files with 60 additions and 13 deletions

View File

@@ -1629,12 +1629,23 @@ struct mkroom *croom;
return;
} while (occupied(m.x, m.y) || bydoor(m.x, m.y));
/* Put a grave at m.x, m.y */
/* Put a grave at <m.x,m.y> */
make_grave(m.x, m.y, dobell ? "Saved by the bell!" : (char *) 0);
/* Possibly fill it with objects */
if (!rn2(3))
(void) mkgold(0L, m.x, m.y);
if (!rn2(3)) {
/* this used to use mkgold(), which puts a stack of gold on
the ground (or merges it with an existing one there if
present), and didn't bother burying it; now we create a
loose, easily buriable, stack but we make no attempt to
replicate mkgold()'s level-based formula for the amount */
struct obj *gold = mksobj(GOLD_PIECE, TRUE, FALSE);
gold->quan = (long) (rnd(20) + level_difficulty() * rnd(5));
gold->owt = weight(gold);
gold->ox = m.x, gold->oy = m.y;
add_to_buried(gold);
}
for (tryct = rn2(5); tryct; tryct--) {
otmp = mkobj(RANDOM_CLASS, TRUE);
if (!otmp)

View File

@@ -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;
}