summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index f73bd222..1f067de3 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -228,26 +228,25 @@ bool Particle::update()
}
return true;
-}
-
-void Particle::moveBy(Vector change)
-{
- mPos += change;
- for (ParticleIterator p = mChildParticles.begin();
- p != mChildParticles.end();
- p++)
- {
- if ((*p)->doesFollow())
- {
- (*p)->moveBy(change);
- }
- }
- return;
-}
-
-void Particle::moveTo(float x, float y)
-{
- moveTo(Vector(x, y, mPos.z));
+}
+
+void Particle::moveBy(const Vector &change)
+{
+ mPos += change;
+ for (ParticleIterator p = mChildParticles.begin();
+ p != mChildParticles.end();
+ p++)
+ {
+ if ((*p)->doesFollow())
+ {
+ (*p)->moveBy(change);
+ }
+ }
+}
+
+void Particle::moveTo(float x, float y)
+{
+ moveTo(Vector(x, y, mPos.z));
}
Particle* Particle::addEffect(const std::string &particleEffectFile,
@@ -297,12 +296,12 @@ Particle* Particle::addEffect(const std::string &particleEffectFile,
// Read and set the basic properties of the particle
float offsetX = XML::getFloatProperty(effectChildNode, "position-x", 0);
float offsetY = XML::getFloatProperty(effectChildNode, "position-y", 0);
- float offsetZ = XML::getFloatProperty(effectChildNode, "position-z", 0);
+ float offsetZ = XML::getFloatProperty(effectChildNode, "position-z", 0);
Vector position (mPos.x + (float)pixelX + offsetX,
mPos.y + (float)pixelY + offsetY,
mPos.z + offsetZ);
- newParticle->moveTo(position);
-
+ newParticle->moveTo(position);
+
int lifetime = XML::getProperty(effectChildNode, "lifetime", -1);
newParticle->setLifetime(lifetime);