summaryrefslogtreecommitdiff
path: root/src/simulation/elements/QRTZ.cpp
diff options
context:
space:
mode:
authorcracker64 <cracker642@gmail.com>2013-02-28 05:40:36 (GMT)
committer cracker64 <cracker642@gmail.com>2013-02-28 05:40:36 (GMT)
commitc65081d3ed44a97cea0f41a63e9ec07cf0feb5f2 (patch)
tree90744a56bc618c12aab5ef617445b283ce2d6d57 /src/simulation/elements/QRTZ.cpp
parent08d1a68ce091b6ba53788224fd1bda92c1895ca6 (diff)
downloadpowder-c65081d3ed44a97cea0f41a63e9ec07cf0feb5f2.zip
powder-c65081d3ed44a97cea0f41a63e9ec07cf0feb5f2.tar.gz
Finished first pass-through for all elements.
Will get a few more places later.
Diffstat (limited to 'src/simulation/elements/QRTZ.cpp')
-rw-r--r--src/simulation/elements/QRTZ.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/simulation/elements/QRTZ.cpp b/src/simulation/elements/QRTZ.cpp
index 20aa97d..e38e11b 100644
--- a/src/simulation/elements/QRTZ.cpp
+++ b/src/simulation/elements/QRTZ.cpp
@@ -49,16 +49,12 @@ 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, t;
- t = parts[i].type;
- if (t == PT_QRTZ)
+ 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))
{
- 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);
- }
+ sim->part_change_type(i,x,y,PT_PQRT);
}
// absorb SLTW
if (parts[i].ctype!=-1)
@@ -69,7 +65,7 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
continue;
- else if ((r&0xFF)==PT_SLTW && (1>rand()%2500))
+ else if ((r&0xFF)==PT_SLTW && !(rand()%2500))
{
sim->kill_part(r>>8);
parts[i].ctype ++;
@@ -92,11 +88,11 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS)
{
parts[np].tmp = parts[i].tmp;
parts[i].ctype--;
- if (5>rand()%10)
+ if (rand()%2)
{
parts[np].ctype=-1;//dead qrtz
}
- else if (!parts[i].ctype && 1>rand()%15)
+ else if (!parts[i].ctype && !(rand()%15))
{
parts[i].ctype=-1;
}
@@ -119,7 +115,7 @@ int Element_QRTZ::update(UPDATE_FUNC_ARGS)
r = pmap[y+ry][x+rx];
if (!r)
continue;
- if ((r&0xFF)==t && (parts[i].ctype>parts[r>>8].ctype) && parts[r>>8].ctype>=0 )//diffusion
+ if ((r&0xFF)==PT_QRTZ && (parts[i].ctype>parts[r>>8].ctype) && parts[r>>8].ctype>=0 )//diffusion
{
tmp = parts[i].ctype - parts[r>>8].ctype;
if (tmp ==1)
@@ -165,4 +161,4 @@ int Element_QRTZ::graphics(GRAPHICS_FUNC_ARGS)
}
-Element_QRTZ::~Element_QRTZ() {} \ No newline at end of file
+Element_QRTZ::~Element_QRTZ() {}