Compare commits

...

2 Commits

Author SHA1 Message Date
jacob1
cde24af43f update comment 2018-04-02 23:04:33 -04:00
jacob1
e5b0a2a401 fix obscure division by 0 issue that only QuanTech would ever be affected by 2018-04-01 19:36:02 -04:00

View File

@ -48,7 +48,11 @@ Element_MERC::Element_MERC()
int Element_MERC::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry, trade, np;
const int absorbScale = 10000;// max number of particles that can be condensed into one
// Max number of particles that can be condensed into one
const int absorbScale = 10000;
// Obscure division by 0 fix
if (parts[i].temp + 1 == 0)
parts[i].temp = 0;
int maxtmp = ((absorbScale/(parts[i].temp + 1))-1);
if ((absorbScale%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1))
maxtmp ++;