1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix crash bug with dynamite/bomb/electro at X=0

GOAL_EXPLOSE1, GOAL_EXPLOSE2, and GOAL_ELECTRO now perform bounds checking before trying to create an explosion.
This commit is contained in:
jummy 2021-02-12 08:07:50 -06:00 committed by Mathieu Schroeter
parent fc01379290
commit c0ffb16d12
No known key found for this signature in database
GPG Key ID: 8B9145A5FA9DA8A8

View File

@ -1531,7 +1531,8 @@ CDecor::GoalNextOp (Sint32 rank, Sint16 * pTable)
y = *pTable++;
GoalAdjustCel (rank, x, y);
cel = GetCel (x, y);
if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY)
return true;
BlupiKill (rank, cel, 0);
MoveFinish (cel);
@ -1562,7 +1563,8 @@ CDecor::GoalNextOp (Sint32 rank, Sint16 * pTable)
y = *pTable++;
GoalAdjustCel (rank, x, y);
cel = GetCel ((x / 2) * 2, (y / 2) * 2);
if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY)
return true;
GetObject (cel, channel, icon);
if (channel != CHOBJECT || icon != 85) // dynamite ?
{
@ -1609,7 +1611,9 @@ CDecor::GoalNextOp (Sint32 rank, Sint16 * pTable)
x = *pTable++;
y = *pTable++;
GoalAdjustCel (rank, x, y);
cel = GetCel ((x / 2) * 2, (y / 2) * 2);
cel = GetCel ((x / 2) * 2, (y / 2) * 2);
if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY)
return true;
icon = *pTable++;
if (MoveCreate (
cel, rank, true, CHFLOOR, -1, -1, -1, 100, 1, 100, false, true))