summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2008-12-14 17:03:30 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2008-12-14 17:03:30 +0100
commit1f76cdae2b7b410657592f95b408bedef46d7a65 (patch)
treeae0aa9f320a2ff12356db9d5c7ac6ab2282a52d2 /src/particle.cpp
parent1dcce99ab2f0573afbab6452526120cf917cd588 (diff)
downloadmana-client-1f76cdae2b7b410657592f95b408bedef46d7a65.tar.gz
mana-client-1f76cdae2b7b410657592f95b408bedef46d7a65.tar.bz2
mana-client-1f76cdae2b7b410657592f95b408bedef46d7a65.tar.xz
mana-client-1f76cdae2b7b410657592f95b408bedef46d7a65.zip
Passing vectors by reference
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 556a8ba2..33bfa648 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -229,25 +229,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);
- }
- }
-}
-
-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 +297,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);