Skip to content

Commit

Permalink
Limit MERC tmp to valid range
Browse files Browse the repository at this point in the history
This preents "anti-mercury" (negative tmp from console) and also
slightly reduces how overpowered it can be in walls (enormous positive
tmp from console).
  • Loading branch information
jacksonmj committed Jul 16, 2016
1 parent bc1dd67 commit 57a3121
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/simulation/elements/MERC.cpp
Expand Up @@ -48,9 +48,20 @@ Element_MERC::Element_MERC()
int Element_MERC::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry, trade, np;
int maxtmp = ((10000/(parts[i].temp + 1))-1);
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
const int absorbScale = 10000;// max number of particles that can be condensed into one
int maxtmp = ((absorbScale/(parts[i].temp + 1))-1);
if ((absorbScale%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
maxtmp ++;

if (parts[i].tmp < 0)
{
parts[i].tmp = 0;
}
if (parts[i].tmp > absorbScale)
{
parts[i].tmp = absorbScale;
}

if (parts[i].tmp < maxtmp)
{
for (rx=-1; rx<2; rx++)
Expand Down

0 comments on commit 57a3121

Please sign in to comment.