mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-13 11:54:04 +02:00
fix issue with molten STKM that could break the simulation and cause crashes
This commit is contained in:
@@ -4002,6 +4002,11 @@ void Simulation::UpdateParticles(int start, int end)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
part_change_type(i,x,y,t);
|
part_change_type(i,x,y,t);
|
||||||
|
// part_change_type could refuse to change the type and kill the particle
|
||||||
|
// for example, changing type to STKM but one already exists
|
||||||
|
// we need to account for that to not cause simulation corruption issues
|
||||||
|
if (parts[i].type == PT_NONE)
|
||||||
|
goto killed;
|
||||||
|
|
||||||
if (t==PT_FIRE || t==PT_PLSM || t==PT_CFLM)
|
if (t==PT_FIRE || t==PT_PLSM || t==PT_CFLM)
|
||||||
parts[i].life = rand()%50+120;
|
parts[i].life = rand()%50+120;
|
||||||
@@ -4131,6 +4136,11 @@ void Simulation::UpdateParticles(int start, int end)
|
|||||||
{
|
{
|
||||||
parts[i].life = 0;
|
parts[i].life = 0;
|
||||||
part_change_type(i,x,y,t);
|
part_change_type(i,x,y,t);
|
||||||
|
// part_change_type could refuse to change the type and kill the particle
|
||||||
|
// for example, changing type to STKM but one already exists
|
||||||
|
// we need to account for that to not cause simulation corruption issues
|
||||||
|
if (parts[i].type == PT_NONE)
|
||||||
|
goto killed;
|
||||||
if (t==PT_FIRE)
|
if (t==PT_FIRE)
|
||||||
parts[i].life = rand()%50+120;
|
parts[i].life = rand()%50+120;
|
||||||
if (t==PT_NONE)
|
if (t==PT_NONE)
|
||||||
|
Reference in New Issue
Block a user