From 2c21399a7e7d30cfb7ac3f46c2d5c329169d6dc4 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 15 Feb 2018 10:13:42 -0800 Subject: [PATCH] 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. --- src/mkmaze.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mkmaze.c b/src/mkmaze.c index 03d993590..b7a33a748 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -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);