Fix traps generated inside walls

When fuzzing, noticed a trap generated inside a wall. Culprit
was one of the themed rooms that generates a rectangular room and then
puts freestanding wall columns inside.  Note in somexy that it can
return a non-accessible location, and change the places that used
it and absolutely needed a space to somexyspace.
This commit is contained in:
Pasi Kallinen
2022-09-09 12:03:08 +03:00
parent 3ee6bcdf76
commit 82867ccdaf
3 changed files with 12 additions and 7 deletions

View File

@@ -1478,7 +1478,7 @@ mktrap(
return;
if (mktrapflags & MKTRAP_MAZEFLAG)
mazexy(&m);
else if (!somexy(croom, &m))
else if (!somexyspace(croom, &m))
return;
} while (occupied(m.x, m.y)
|| (avoid_boulder && sobj_at(BOULDER, m.x, m.y)));
@@ -1778,7 +1778,7 @@ find_okay_roompos(struct mkroom *croom, coord *crd)
do {
if (++tryct > 200)
return FALSE;
if (!somexy(croom, crd))
if (!somexyspace(croom, crd))
return FALSE;
} while (occupied(crd->x, crd->y) || bydoor(crd->x, crd->y));
return TRUE;