summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2008-12-14 17:03:30 +0100
committerIra Rice <irarice@gmail.com>2008-12-14 09:26:17 -0700
commitfbbb9658d4d90a1080d28f3a720d2777939e8cb6 (patch)
treeda5f832af2621d08afaabeac5be45e5a08aa31ab /src/particle.cpp
parent86f666f90322f5d39aa5d0f0ad973e1df8f744d3 (diff)
downloadmana-fbbb9658d4d90a1080d28f3a720d2777939e8cb6.tar.gz
mana-fbbb9658d4d90a1080d28f3a720d2777939e8cb6.tar.bz2
mana-fbbb9658d4d90a1080d28f3a720d2777939e8cb6.tar.xz
mana-fbbb9658d4d90a1080d28f3a720d2777939e8cb6.zip
Passing vectors by reference
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);