diff options
| author | jacob1 <jfu614@gmail.com> | 2013-05-30 00:36:34 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-05-30 00:36:34 (GMT) |
| commit | d6d20defdebf72c2b27244a6d4bc8a757a669a59 (patch) | |
| tree | a3802256a9377cf5b048a01a91a31a470be3c7c3 /src/simulation/elements/QRTZ.cpp | |
| parent | cbc80de6522b5562f9490b0cdb620371f25be2f9 (diff) | |
| parent | 41e369e68eac7b05f8cda312f9668942dc688aa7 (diff) | |
| download | powder-d6d20defdebf72c2b27244a6d4bc8a757a669a59.zip powder-d6d20defdebf72c2b27244a6d4bc8a757a669a59.tar.gz | |
Merge branch 'master' of git@github.com:FacialTurd/The-Powder-Toy.git
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) |
