TPT: fix crash, spark reset set type without checking if it was a valid number
This commit is contained in:
parent
b8f2a2dcd5
commit
3b020b3151
@ -1127,9 +1127,14 @@ int luatpt_reset_spark(lua_State* l)
|
|||||||
for (i=0; i<NPART; i++)
|
for (i=0; i<NPART; i++)
|
||||||
{
|
{
|
||||||
if (luacon_sim->parts[i].type==PT_SPRK)
|
if (luacon_sim->parts[i].type==PT_SPRK)
|
||||||
|
{
|
||||||
|
if (luacon_sim->parts[i].ctype >= 0 && luacon_sim->parts[i].ctype < PT_NUM)
|
||||||
{
|
{
|
||||||
luacon_sim->parts[i].type = luacon_sim->parts[i].ctype;
|
luacon_sim->parts[i].type = luacon_sim->parts[i].ctype;
|
||||||
luacon_sim->parts[i].life = 4;
|
luacon_sim->parts[i].life = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
luacon_sim->kill_part(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user