From 5fa6e6bd8d146b322deb16c288ed7ad97cc1b4cd Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 25 Apr 2024 22:28:21 +0300 Subject: [PATCH] Prevent explosions moving objects out of map --- src/explode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/explode.c b/src/explode.c index 768aa72c9..c2b76bf4a 100644 --- a/src/explode.c +++ b/src/explode.c @@ -840,7 +840,10 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */ gt.thrownobj = stmp->obj; /* mainly in case it kills hero */ gb.bhitpos.x = stmp->ox + stmp->dx; gb.bhitpos.y = stmp->oy + stmp->dy; - typ = levl[gb.bhitpos.x][gb.bhitpos.y].typ; + if (isok(gb.bhitpos.x, gb.bhitpos.y)) + typ = levl[gb.bhitpos.x][gb.bhitpos.y].typ; + else + typ = STONE; if (!isok(gb.bhitpos.x, gb.bhitpos.y)) { gb.bhitpos.x -= stmp->dx; gb.bhitpos.y -= stmp->dy;