Fix monsters overflowing out of rooms in special levels

In a special level, creating more monsters inside room contents
than was space in the room placed monsters outside the room,
possibly inside walls of rooms created afterwards.

Prevent monster creation if inside room contents and there's no
space for the monster.
This commit is contained in:
Pasi Kallinen
2020-03-29 11:17:37 +03:00
parent 87513ad6bf
commit 3776b7d382
2 changed files with 8 additions and 0 deletions

View File

@@ -652,6 +652,11 @@ inside_room(croom, x, y)
struct mkroom *croom;
xchar x, y;
{
if (croom->irregular) {
int i = (int) ((croom - g.rooms) + ROOMOFFSET);
return (!levl[x][y].edge && (int) levl[x][y].roomno == i);
}
return (boolean) (x >= croom->lx - 1 && x <= croom->hx + 1
&& y >= croom->ly - 1 && y <= croom->hy + 1);
}

View File

@@ -1794,6 +1794,9 @@ struct mkroom *croom;
if (MON_AT(x, y) && enexto(&cc, x, y, pm))
x = cc.x, y = cc.y;
if (croom && !inside_room(croom, x, y))
return;
if (m->align != AM_SPLEV_RANDOM)
mtmp = mk_roamer(pm, Amask2align(amask), x, y, m->peaceful);
else if (PM_ARCHEOLOGIST <= m->id && m->id <= PM_WIZARD)