Skip to content

Commit

Permalink
fix issue with molten STKM that could break the simulation and cause …
Browse files Browse the repository at this point in the history
…crashes
  • Loading branch information
jacob1 committed Sep 29, 2017
1 parent fffe1b0 commit 77b6f44
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/simulation/Simulation.cpp
Expand Up @@ -4002,6 +4002,11 @@ void Simulation::UpdateParticles(int start, int end)
}
else
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)
parts[i].life = rand()%50+120;
Expand Down Expand Up @@ -4131,6 +4136,11 @@ void Simulation::UpdateParticles(int start, int end)
{
parts[i].life = 0;
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)
parts[i].life = rand()%50+120;
if (t==PT_NONE)
Expand Down

0 comments on commit 77b6f44

Please sign in to comment.