Permalink
Browse files

Limit MERC tmp to valid range

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 15, 2016
1 parent bc1dd67 commit 57a3121a51cf7d65fa7dfee7c286a6c6277d2859
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/simulation/elements/MERC.cpp
@@ -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++)

0 comments on commit 57a3121

Please sign in to comment.