summaryrefslogtreecommitdiff
path: root/src/simulation/elements
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-12-06 16:01:46 (GMT)
committer jacob1 <jfu614@gmail.com>2012-12-06 16:01:46 (GMT)
commit122599763ef9827d7aadc0fe0295c2fbc96e82ab (patch)
treedcf0a21b20cd38a12dee93d9db6115da6c0fdb35 /src/simulation/elements
parent2d7ac84c1dca8521f41cf023774b7a90e300b3bf (diff)
parent9bf5eeeef919260458637e84f3388b4d7d8204c5 (diff)
downloadpowder-122599763ef9827d7aadc0fe0295c2fbc96e82ab.zip
powder-122599763ef9827d7aadc0fe0295c2fbc96e82ab.tar.gz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/simulation/elements')
-rw-r--r--src/simulation/elements/CLST.cpp4
-rw-r--r--src/simulation/elements/SWCH.cpp2
-rw-r--r--src/simulation/elements/VIBR.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/simulation/elements/CLST.cpp b/src/simulation/elements/CLST.cpp
index 3cab1f7..ab62acb 100644
--- a/src/simulation/elements/CLST.cpp
+++ b/src/simulation/elements/CLST.cpp
@@ -50,7 +50,7 @@ Element_CLST::Element_CLST()
int Element_CLST::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
- float cxy;
+ float cxy = 0;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -76,7 +76,7 @@ int Element_CLST::update(UPDATE_FUNC_ARGS)
cxy = 0.015;
if(parts[i].temp >= 295 && parts[i].temp <350)
cxy = 0.01;
- if(parts[i].temp > 350)
+ if(parts[i].temp >= 350)
cxy = 0.005;
parts[i].vx += cxy*rx;
parts[i].vy += cxy*ry;//These two can be set not to calculate over 350 later. They do virtually nothing over 0.005.
diff --git a/src/simulation/elements/SWCH.cpp b/src/simulation/elements/SWCH.cpp
index 818af27..422b7b5 100644
--- a/src/simulation/elements/SWCH.cpp
+++ b/src/simulation/elements/SWCH.cpp
@@ -76,7 +76,7 @@ int Element_SWCH::update(UPDATE_FUNC_ARGS)
parts[i].life = parts[r>>8].life;
}
}
- else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) {
+ else if (rt==PT_SPRK && parts[i].life==10 && parts[r>>8].life>0 && parts[r>>8].ctype!=PT_PSCN && parts[r>>8].ctype!=PT_NSCN) {
sim->part_change_type(i,x,y,PT_SPRK);
parts[i].ctype = PT_SWCH;
parts[i].life = 4;
diff --git a/src/simulation/elements/VIBR.cpp b/src/simulation/elements/VIBR.cpp
index 68119f7..7a8c30c 100644
--- a/src/simulation/elements/VIBR.cpp
+++ b/src/simulation/elements/VIBR.cpp
@@ -149,7 +149,7 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) {
if (!r)
continue;
//Melts into EXOT
- if ((r&0xFF) == PT_EXOT && !(rand()%250))
+ if ((r&0xFF) == PT_EXOT && !(rand()%250) && !parts[i].life)
{
sim->create_part(i, x, y, PT_EXOT);
}
@@ -163,7 +163,7 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) {
parts[r>>8].tmp += 10;
}
//Absorbs energy particles
- if ((sim->elements[r&0xFF].Properties & TYPE_ENERGY))
+ if ((sim->elements[r&0xFF].Properties & TYPE_ENERGY) && !parts[i].life)
{
parts[i].tmp += 20;
sim->kill_part(r>>8);