diff options
| author | jacob1 <jfu614@gmail.com> | 2013-05-20 15:26:51 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-05-20 15:26:51 (GMT) |
| commit | 826b966668fe37d836de91cf29a6db0d1afee1f4 (patch) | |
| tree | f617c944418a227769408b75b075d334df93417c /src/simulation/elements/QRTZ.cpp | |
| parent | 77bf649fb4482c86ac1fd9b3233f062b53226007 (diff) | |
| download | powder-826b966668fe37d836de91cf29a6db0d1afee1f4.zip powder-826b966668fe37d836de91cf29a6db0d1afee1f4.tar.gz | |
reduce rand() chances to 5x the old values in elements that were changed to 3x3 loop checks instead of 5x5. Also some other fixes I found when looking at what had been changed.
Diffstat (limited to 'src/simulation/elements/QRTZ.cpp')
| -rw-r--r-- | src/simulation/elements/QRTZ.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/simulation/elements/QRTZ.cpp b/src/simulation/elements/QRTZ.cpp index a9510b1..5eec6d6 100644 --- a/src/simulation/elements/QRTZ.cpp +++ b/src/simulation/elements/QRTZ.cpp @@ -26,7 +26,7 @@ Element_QRTZ::Element_QRTZ() Weight = 100; - Temperature = R_TEMP+0.0f +273.15f; + Temperature = R_TEMP+273.15f; HeatConduct = 3; Description = "Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures."; @@ -49,23 +49,26 @@ Element_QRTZ::Element_QRTZ() //#TPT-Directive ElementHeader Element_QRTZ static int update(UPDATE_FUNC_ARGS) int Element_QRTZ::update(UPDATE_FUNC_ARGS) { - int r, tmp, trade, rx, ry, np; - parts[i].pavg[0] = parts[i].pavg[1]; - parts[i].pavg[1] = sim->pv[y/CELL][x/CELL]; - if (parts[i].pavg[1]-parts[i].pavg[0] > 0.05*(parts[i].temp/3) || parts[i].pavg[1]-parts[i].pavg[0] < -0.05*(parts[i].temp/3)) + int r, tmp, trade, rx, ry, np, t = parts[i].type; + if (t == PT_QRTZ) { - sim->part_change_type(i,x,y,PT_PQRT); + parts[i].pavg[0] = parts[i].pavg[1]; + parts[i].pavg[1] = sim->pv[y/CELL][x/CELL]; + if (parts[i].pavg[1]-parts[i].pavg[0] > 0.05*(parts[i].temp/3) || parts[i].pavg[1]-parts[i].pavg[0] < -0.05*(parts[i].temp/3)) + { + sim->part_change_type(i,x,y,PT_PQRT); + } } // absorb SLTW if (parts[i].ctype!=-1) - for (rx=-2; rx<3; rx++) - for (ry=-2; ry<3; ry++) + for (rx=-1; rx<2; rx++) + for (ry=-1; ry<2; ry++) if (BOUNDS_CHECK && (rx || ry)) { r = pmap[y+ry][x+rx]; if (!r) continue; - else if ((r&0xFF)==PT_SLTW && !(rand()%2500)) + else if ((r&0xFF)==PT_SLTW && !(rand()%500)) { sim->kill_part(r>>8); parts[i].ctype ++; @@ -111,7 +114,7 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS) r = pmap[y+ry][x+rx]; if (!r) continue; - else if ((r&0xFF)==PT_QRTZ && (parts[i].ctype>parts[r>>8].ctype) && parts[r>>8].ctype>=0 ) + else if ((r&0xFF)==PT_QRTZ && (parts[i].ctype>parts[r>>8].ctype) && parts[r>>8].ctype>=0) { tmp = parts[i].ctype - parts[r>>8].ctype; if (tmp ==1) |
