Prevent explosions moving objects out of map

This commit is contained in:
Pasi Kallinen
2024-04-25 22:28:21 +03:00
parent 472cb7f7fa
commit 5fa6e6bd8d

View File

@@ -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;