Permalink
Browse files

Fix IRON rust

Fix some randoms
  • Loading branch information...
cracker64 committed Dec 6, 2014
1 parent a115e78 commit 6410171bd5706eb5236b3be3289e0ac201b8c083
Showing with 7 additions and 7 deletions.
  1. +5 −5 src/simulation/elements/GOLD.cpp
  2. +1 −1 src/simulation/elements/IRON.cpp
  3. +1 −1 src/simulation/elements/VIRS.cpp
@@ -56,9 +56,9 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
//Find nearby rusted iron (BMTL with tmp 1+)
for(int j = 0; j < 8; j++){
rndstore = rand();
rx = ((rndstore & 0xF) % 9)-4;
rx = (rndstore % 9)-4;
rndstore >>= 4;
ry = ((rndstore & 0xF) % 9)-4;
ry = (rndstore % 9)-4;
if ((!rx != !ry) && BOUNDS_CHECK) {
r = pmap[y+ry][x+rx];
if(!r) continue;
@@ -101,11 +101,11 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
int Element_GOLD::graphics(GRAPHICS_FUNC_ARGS)
{
int rndstore = rand();
*colr += (rndstore & 0xF) % 10 - 5;
*colr += (rndstore % 10) - 5;
rndstore >>= 4;
*colg += (rndstore & 0xF) % 10 - 5;
*colg += (rndstore % 10)- 5;
rndstore >>= 4;
*colb += (rndstore & 0xF) % 10 - 5;
*colb += (rndstore % 10) - 5;
return 0;
}

@@ -50,7 +50,7 @@ Element_IRON::Element_IRON()
int Element_IRON::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry, rt;
if (!parts[i].life)
if (parts[i].life)
return 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
@@ -127,7 +127,7 @@ int Element_VIRS::update(UPDATE_FUNC_ARGS)
parts[r>>8].pavg[0] = 0;
if (parts[i].pavg[1])
{
parts[r>>8].pavg[1] = parts[i].pavg[1] + ((rndstore & 0x3) % 3 ? 1 : 0);
parts[r>>8].pavg[1] = parts[i].pavg[1] + ((rndstore % 3) ? 1 : 0);
rndstore >>= 2;
}
else

0 comments on commit 6410171

Please sign in to comment.