summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-12 16:02:15 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-12 16:02:15 +0300
commit47cf0d69e8026927ca69547a17ac8e1d288538b7 (patch)
treeb8ec4ec0879b82a71994651f1454e039570f4fe5 /src
parent8f0610ac50a950f6c8b101191dd30956c851aaf7 (diff)
downloadmanaplus-47cf0d69e8026927ca69547a17ac8e1d288538b7.tar.gz
manaplus-47cf0d69e8026927ca69547a17ac8e1d288538b7.tar.bz2
manaplus-47cf0d69e8026927ca69547a17ac8e1d288538b7.tar.xz
manaplus-47cf0d69e8026927ca69547a17ac8e1d288538b7.zip
Improve a bit particles creation.
Diffstat (limited to 'src')
-rw-r--r--src/particle/particle.cpp7
-rw-r--r--src/particle/particleemitter.cpp9
-rw-r--r--src/particle/particleemitter.h4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 9dee09754..b487e5ffb 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -203,8 +203,11 @@ bool Particle::update()
{
FOR_EACH (EmitterConstIterator, e, mChildEmitters)
{
- Particles newParticles = (*e)->createParticles(mLifetimePast);
- FOR_EACH (ParticleConstIterator, it, newParticles)
+ std::vector<Particle*> newParticles;
+ (*e)->createParticles(mLifetimePast, newParticles);
+ FOR_EACH (std::vector<Particle*>::const_iterator,
+ it,
+ newParticles)
{
Particle *const p = *it;
p->moveBy(mPos);
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index af9b32fe4..5cba3ba54 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -483,14 +483,13 @@ ParticleEmitter::readParticleEmitterProp(XmlNodePtrConst propertyNode, T def)
return retval;
}
-std::list<Particle *> ParticleEmitter::createParticles(const int tick)
+void ParticleEmitter::createParticles(const int tick,
+ std::vector<Particle*> &newParticles)
{
- std::list<Particle *> newParticles;
-
if (mOutputPauseLeft > 0)
{
mOutputPauseLeft --;
- return newParticles;
+ return;
}
mOutputPauseLeft = mOutputPause.value(tick);
@@ -574,8 +573,6 @@ std::list<Particle *> ParticleEmitter::createParticles(const int tick)
newParticles.push_back(newParticle);
}
-
- return newParticles;
}
void ParticleEmitter::adjustSize(const int w, const int h)
diff --git a/src/particle/particleemitter.h b/src/particle/particleemitter.h
index 395f09ac4..41381b6e1 100644
--- a/src/particle/particleemitter.h
+++ b/src/particle/particleemitter.h
@@ -66,9 +66,9 @@ class ParticleEmitter final
/**
* Spawns new particles
- * @return: a list of created particles
*/
- std::list<Particle *> createParticles(const int tick);
+ void createParticles(const int tick,
+ std::vector<Particle*> &newParticles);
/**
* Sets the target of the particles that are created