diff --git a/src/simulation/elements/CAUS.cpp b/src/simulation/elements/CAUS.cpp index fe205c0af..247bcf8c6 100644 --- a/src/simulation/elements/CAUS.cpp +++ b/src/simulation/elements/CAUS.cpp @@ -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."; @@ -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) @@ -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;