Avoid premapping outside Sokoban map to prevent showing stone glyphs

If user has changed the stone glyph to something other than a space
(or uses a tileset), Sokoban levels showed the unreachable stone outside
the map area.  Prevent marking those areas as seen, so the stone
glyphs aren't shown.
This commit is contained in:
Pasi Kallinen
2025-04-09 18:40:56 +03:00
parent 3aecc90b2d
commit 2065d2d392
2 changed files with 14 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ staticfn void foundone(coordxy, coordxy, int);
staticfn void findone(coordxy, coordxy, genericptr_t);
staticfn void openone(coordxy, coordxy, genericptr_t);
staticfn int mfind0(struct monst *, boolean);
staticfn boolean skip_premap_detect(coordxy, coordxy);
staticfn int reveal_terrain_getglyph(coordxy, coordxy, unsigned, int,
unsigned);
@@ -2117,6 +2118,16 @@ warnreveal(void)
}
}
/* skip premap detection of areas outside Sokoban map */
staticfn boolean
skip_premap_detect(coordxy x, coordxy y)
{
if ((levl[x][y].typ == STONE)
&& (levl[x][y].wall_info & (W_NONDIGGABLE | W_NONPASSWALL)) != 0)
return TRUE;
return FALSE;
}
/* Pre-map (the sokoban) levels */
void
premap_detect(void)
@@ -2128,6 +2139,8 @@ premap_detect(void)
/* Map the background and boulders */
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
if (skip_premap_detect(x, y))
continue;
levl[x][y].seenv = SVALL;
levl[x][y].waslit = TRUE;
if (levl[x][y].typ == SDOOR)