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).
This commit is contained in:
jacksonmj
2016-07-16 00:54:13 +01:00
parent bc1dd6748c
commit 57a3121a51

View File

@@ -48,9 +48,20 @@ Element_MERC::Element_MERC()
int Element_MERC::update(UPDATE_FUNC_ARGS) int Element_MERC::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry, trade, np; int r, rx, ry, trade, np;
int maxtmp = ((10000/(parts[i].temp + 1))-1); const int absorbScale = 10000;// max number of particles that can be condensed into one
if ((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1)) int maxtmp = ((absorbScale/(parts[i].temp + 1))-1);
if ((absorbScale%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
maxtmp ++; maxtmp ++;
if (parts[i].tmp < 0)
{
parts[i].tmp = 0;
}
if (parts[i].tmp > absorbScale)
{
parts[i].tmp = absorbScale;
}
if (parts[i].tmp < maxtmp) if (parts[i].tmp < maxtmp)
{ {
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)