Skip to content

Commit

Permalink
minor efficiency fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Mar 10, 2018
1 parent ad5b12f commit ab4cdf2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/simulation/Simulation.cpp
Expand Up @@ -4108,6 +4108,11 @@ void Simulation::UpdateParticles(int start, int end)
if ((elements[t].Properties&TYPE_GAS) && !(elements[parts[i].type].Properties&TYPE_GAS))
pv[y/CELL][x/CELL] += 0.50f;

if (t == PT_NONE)
{
kill_part(i);
goto killed;
}
if (part_change_type(i,x,y,t))
goto killed;
// part_change_type could refuse to change the type and kill the particle
Expand Down Expand Up @@ -4242,6 +4247,11 @@ void Simulation::UpdateParticles(int start, int end)
// particle type change occurred
if (s)
{
if (t == PT_NONE)
{
kill_part(i);
goto killed;
}
parts[i].life = 0;
// part_change_type could refuse to change the type and kill the particle
// for example, changing type to STKM but one already exists
Expand Down

0 comments on commit ab4cdf2

Please sign in to comment.