From 1d1ac3f13f96f0fa69fc57ea61af6e59d4e910a9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 Nov 2015 18:35:07 +0300 Subject: Allow kill infinite particles if parent particle will be removed. --- src/particle/particle.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/particle/particle.cpp') 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); -- cgit v1.2.3-70-g09d2