Skip to content

Commit

Permalink
fix negative tmp sing possibly generating max particles
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jan 17, 2015
1 parent 8c1db51 commit 94e635b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/simulation/elements/SING.cpp
Expand Up @@ -49,7 +49,7 @@ Element_SING::Element_SING()
//#TPT-Directive ElementHeader Element_SING static int update(UPDATE_FUNC_ARGS)
int Element_SING::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry, cry, crx, nb, j, spawncount;
int r, rx, ry, cry, crx, nb, spawncount;
int singularity = -parts[i].life;
float angle, v;

Expand Down Expand Up @@ -82,11 +82,9 @@ int Element_SING::update(UPDATE_FUNC_ARGS)
}
}
}
spawncount = (parts[i].tmp>255)?255:parts[i].tmp;
if (spawncount>=1)
spawncount = spawncount/8;
spawncount = spawncount*spawncount*M_PI;
for (j=0;j<spawncount;j++)
spawncount = std::abs(parts[i].tmp);
spawncount = (spawncount>255) ? 3019 : std::pow((int)(spawncount/8), 2)*M_PI;
for (int j = 0;j < spawncount; j++)
{
switch(rand()%3)
{
Expand Down

0 comments on commit 94e635b

Please sign in to comment.