Skip to content

Commit

Permalink
Fix IRON rust
Browse files Browse the repository at this point in the history
Fix some randoms
  • Loading branch information
pilihp64 committed Dec 6, 2014
1 parent a115e78 commit 6410171
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/simulation/elements/GOLD.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/simulation/elements/IRON.cpp
Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/elements/VIRS.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 6410171

Please sign in to comment.