summaryrefslogtreecommitdiff
path: root/src/simulation/elements/ACEL.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-02-24 11:50:10 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-02-24 11:50:10 (GMT)
commit8dfb1ecf8756e930c45482f707d00f188ff2ce53 (patch)
tree2b83296b8ce2ef2fd8a99ac4e946014dcf35501d /src/simulation/elements/ACEL.cpp
parent934dbe35182af9760c4c916bd99e4603a988c01d (diff)
downloadpowder-8dfb1ecf8756e930c45482f707d00f188ff2ce53.zip
powder-8dfb1ecf8756e930c45482f707d00f188ff2ce53.tar.gz
ACEL and DCEL use life for strength value
Diffstat (limited to 'src/simulation/elements/ACEL.cpp')
-rw-r--r--src/simulation/elements/ACEL.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/simulation/elements/ACEL.cpp b/src/simulation/elements/ACEL.cpp
index 81eeaf3..35f77dc 100644
--- a/src/simulation/elements/ACEL.cpp
+++ b/src/simulation/elements/ACEL.cpp
@@ -50,23 +50,23 @@ Element_ACEL::Element_ACEL()
int Element_ACEL::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
- parts[i].tmp = 0;
- for (rx=-1; rx<2; rx++)
- for (ry=-1; ry<2; ry++)
- if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry))
- {
- r = pmap[y+ry][x+rx];
- if(!r)
- r = sim->photons[y+ry][x+rx];
- if ((r>>8)>=NPART || !r)
- continue;
- if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
- {
- if (parts[i].ctype)
- {
- int change = parts[i].ctype > 1000 ? 1000 : parts[i].ctype < 0 ? 0 : parts[i].ctype;
- parts[r>>8].vx *= 1+change/100.0f;
- parts[r>>8].vy *= 1+change/100.0f;
+ float change = parts[i].life > 1000 ? 1000 : (parts[i].life < 0 ? 0 : parts[i].life);
+ parts[i].tmp = 0;
+ for (rx=-1; rx<2; rx++)
+ for (ry=-1; ry<2; ry++)
+ if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry) && !(rx && ry))
+ {
+ r = pmap[y+ry][x+rx];
+ if(!r)
+ r = sim->photons[y+ry][x+rx];
+ if ((r>>8)>=NPART || !r)
+ continue;
+ if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
+ {
+ if (parts[i].life)
+ {
+ parts[r>>8].vx *= 1.0f+(change/100.0f);
+ parts[r>>8].vy *= 1.0f+(change/100.0f);
}
else
{