place_lregion() bug

Noticed while looking into the TROUBLE_STUCK_IN_WALL prayer bug,
place_lregion() has been using the wrong row for 'low y' in its
whole-level handling, presumeably ever since it was first introduced.
3.4.3 definitely had the same bug; I didn't check any further back.

For maze levels which only consider every other row and every other
column to be viable locations this probably didn't matter.  And even
non-maze levels usually don't have anything on row 0, so this fix
isn't likely to be noticeable.
This commit is contained in:
PatR
2018-02-15 10:13:42 -08:00
parent 687902d3ff
commit 2c21399a7e

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1469930897 2016/07/31 02:08:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.50 $ */
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1518718417 2018/02/15 18:13:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.55 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -287,9 +287,9 @@ d_level *lev;
return;
}
lx = 1;
lx = 1; /* column 0 is not used */
hx = COLNO - 1;
ly = 1;
ly = 0; /* 3.6.0 and earlier erroneously had 1 here */
hy = ROWNO - 1;
}
@@ -305,11 +305,9 @@ d_level *lev;
/* then a deterministic one */
oneshot = TRUE;
for (x = lx; x <= hx; x++)
for (y = ly; y <= hy; y++)
if (put_lregion_here(x, y, nlx, nly, nhx, nhy, rtype, oneshot,
lev))
if (put_lregion_here(x, y, nlx, nly, nhx, nhy, rtype, TRUE, lev))
return;
impossible("Couldn't place lregion type %d!", rtype);