summaryrefslogtreecommitdiff
path: root/src/particle/particle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-24 18:35:07 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-24 18:35:07 +0300
commit1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9 (patch)
treeb97a0117d58e382191aaaf2d9770b9e3e0275f0f /src/particle/particle.cpp
parenta6c1e29279d28b18012e1a87d23ff114302bd610 (diff)
downloadmv-1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9.tar.gz
mv-1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9.tar.bz2
mv-1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9.tar.xz
mv-1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9.zip
Allow kill infinite particles if parent particle will be removed.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r--src/particle/particle.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index b487e5ffb..dc566bb4e 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -477,6 +477,23 @@ void Particle::adjustEmitterSize(const int w, const int h)
}
}
+void Particle::prepareToDie()
+{
+ FOR_EACH (ParticleIterator, p, mChildParticles)
+ {
+ Particle *const particle = *p;
+ if (!particle)
+ continue;
+ particle->prepareToDie();
+ if (particle->isAlive() &&
+ particle->mLifetimeLeft == -1 &&
+ particle->mAutoDelete)
+ {
+ particle->kill();
+ }
+ }
+}
+
void Particle::clear()
{
delete_all(mChildEmitters);