From b3b6477339cf98c31ca42bd88ef20f0b8c1290f5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 19 May 2016 19:40:14 +0300 Subject: Dont try to move child particles if current particle already dead. --- src/particle/particle.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/particle') diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index de85d2a59..8ebde0a2b 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -291,25 +291,32 @@ bool Particle::update() restrict2 } updateSelf(); } - } - - const Vector change = mPos - oldPos; - if (mChildParticles.empty()) - { - if (mAlive != AliveStatus::ALIVE && - mAutoDelete) + const Vector change = mPos - oldPos; + if (mChildParticles.empty()) { - return false; + if (mAlive != AliveStatus::ALIVE && + mAutoDelete) + { + return false; + } + return true; + } + for (ParticleIterator p = mChildMoveParticles.begin(), + fp2 = mChildMoveParticles.end(); p != fp2; ) + { + // move particle with its parent if desired + (*p)->moveBy(change); } - return true; } - - for (ParticleIterator p = mChildMoveParticles.begin(), - fp2 = mChildMoveParticles.end(); p != fp2; ) + else { - // move particle with its parent if desired - (*p)->moveBy(change); + if (mChildParticles.empty()) + { + if (mAutoDelete) + return false; + return true; + } } // Update child particles -- cgit v1.2.3-60-g2f50