summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:14:23 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-17 16:14:23 (GMT)
commitca1690efe14d5cbb1637e9114403afffc3f75984 (patch)
tree013bacc68a395bb1b24ca39622febedcb236faf8 /src/simulation/Simulation.cpp
parent75f62127518895ae9acddfd2644a67ab8796253c (diff)
downloadpowder-ca1690efe14d5cbb1637e9114403afffc3f75984.zip
powder-ca1690efe14d5cbb1637e9114403afffc3f75984.tar.gz
TPT: Separate loop for updating life, and add SPRK life checks to most electronics 6bdc05cc40
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index ab4a852..a1ddb68 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2278,6 +2278,7 @@ void Simulation::update_particles_i(int start, int inc)
int surround[8];
int surround_hconduct[8];
int lighting_ok=1;
+ unsigned int elem_properties;
float pGravX, pGravY, pGravD;
if (lighting_recreate>0)
@@ -2410,7 +2411,6 @@ void Simulation::update_particles_i(int start, int inc)
else
wireless[q][1] = 0;
}
- //the main particle loop function, goes over all particles.
for (i=0; i<=parts_lastActiveIndex; i++)
if (parts[i].type)
{
@@ -2420,25 +2420,32 @@ void Simulation::update_particles_i(int start, int inc)
kill_part(i);
continue;
}
- //printf("parts[%d].type: %d\n", i, parts[i].type);
- if (parts[i].life>0 && (ptypes[t].properties&PROP_LIFE_DEC))
+ elem_properties = ptypes[t].properties;
+ if (parts[i].life>0 && (elem_properties&PROP_LIFE_DEC))
{
// automatically decrease life
parts[i].life--;
- if (parts[i].life<=0 && (ptypes[t].properties&(PROP_LIFE_KILL_DEC|PROP_LIFE_KILL)))
+ if (parts[i].life<=0 && (elem_properties&(PROP_LIFE_KILL_DEC|PROP_LIFE_KILL)))
{
// kill on change to no life
kill_part(i);
continue;
}
}
- else if (parts[i].life<=0 && (ptypes[t].properties&PROP_LIFE_KILL))
+ else if (parts[i].life<=0 && (elem_properties&PROP_LIFE_KILL))
{
// kill if no life
kill_part(i);
continue;
}
+ }
+ //the main particle loop function, goes over all particles.
+
+ for (i=0; i<=parts_lastActiveIndex; i++)
+ if (parts[i].type)
+ {
+ t = parts[i].type;
x = (int)(parts[i].x+0.5f);
y = (int)(parts[i].y+0.5f);