Skip to content

Commit

Permalink
CAUS.cpp whitespace fixes, closes #464
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jul 14, 2017
1 parent 711d15f commit 781a90a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/simulation/elements/CAUS.cpp
Expand Up @@ -26,7 +26,7 @@ Element_CAUS::Element_CAUS()

Weight = 1;

Temperature = R_TEMP+0.0f +273.15f;
Temperature = R_TEMP+273.15f;
HeatConduct = 70;
Description = "Caustic Gas, acts like ACID.";

Expand All @@ -47,12 +47,11 @@ Element_CAUS::Element_CAUS()
//#TPT-Directive ElementHeader Element_CAUS static int update(UPDATE_FUNC_ARGS)
int Element_CAUS::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
for (int rx = -2; rx <= 2; rx++)
for (int ry = -2; ry <= 2; ry++)
if (BOUNDS_CHECK && (rx || ry))
{
r = pmap[y+ry][x+rx];
int r = pmap[y+ry][x+rx];
if (!r)
continue;
if ((r&0xFF) == PT_GAS)
Expand All @@ -63,22 +62,22 @@ int Element_CAUS::update(UPDATE_FUNC_ARGS)
sim->part_change_type(i, x, y, PT_RFRG);
}
}
else if ((r&0xFF)!=PT_ACID && (r&0xFF)!=PT_CAUS && (r&0xFF)!=PT_RFRG && (r&0xFF)!=PT_RFGL)
else if ((r&0xFF) != PT_ACID && (r&0xFF) != PT_CAUS && (r&0xFF) != PT_RFRG && (r&0xFF) != PT_RFGL)
{
if (((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && sim->elements[r&0xFF].Hardness>(rand()%1000))&&parts[i].life>=50)
if (((r&0xFF) != PT_CLNE && (r&0xFF) != PT_PCLN && sim->elements[r&0xFF].Hardness > (rand()%1000)) && parts[i].life >= 50)
{
if (sim->parts_avg(i, r>>8,PT_GLAS)!= PT_GLAS)//GLAS protects stuff from acid
// GLAS protects stuff from acid
if (sim->parts_avg(i, r>>8,PT_GLAS) != PT_GLAS)
{
float newtemp = ((60.0f-(float)sim->elements[r&0xFF].Hardness))*7.0f;
if(newtemp < 0){
float newtemp = ((60.0f - (float)sim->elements[r&0xFF].Hardness)) * 7.0f;
if (newtemp < 0)
newtemp = 0;
}
parts[i].temp += newtemp;
parts[i].life--;
sim->kill_part(r>>8);
}
}
else if (parts[i].life<=50)
else if (parts[i].life <= 50)
{
sim->kill_part(i);
return 1;
Expand Down

0 comments on commit 781a90a

Please sign in to comment.