git pull request #123 - wallification vs map edge

Fixes #123

Make sure wallification doesn't go out of bounds when operating
near the map edge.  The top and left edges were ok (although the
left edge could uselessly try to wallify unused column 0) but the
right and bottom ones weren't validating the map boundary.  None
of the 3.6.x levels were affected.

I've done this a little differently from the suggested commit in
the pull request.
This commit is contained in:
PatR
2018-08-14 18:06:59 -07:00
parent 34c1d30370
commit 854155dfa9
2 changed files with 8 additions and 2 deletions

View File

@@ -83,6 +83,8 @@ succubus/incubus seduction might result in loss of levitation which in turn
fix hole/trapdoor passage inconsistency when polymorphed into a giant
making a wide-open special level with FLAGS:inaccessibles could trigger a
"floodfill stack overrun" panic (no 3.6.x levels were affected)
wallifying a special level might go out of map bounds (not with 3.6.x levels)
and corrupt other level data
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -2552,19 +2552,23 @@ region *tmpregion;
}
}
void
STATIC_OVL void
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++)