summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-19 19:40:14 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-19 19:40:14 +0300
commitb3b6477339cf98c31ca42bd88ef20f0b8c1290f5 (patch)
treea2ff144786ebd7a10412eebf1bacd31299a796d7
parentd868ad1e79db15fce9d41370bdb4284c46df2120 (diff)
downloadmv-b3b6477339cf98c31ca42bd88ef20f0b8c1290f5.tar.gz
mv-b3b6477339cf98c31ca42bd88ef20f0b8c1290f5.tar.bz2
mv-b3b6477339cf98c31ca42bd88ef20f0b8c1290f5.tar.xz
mv-b3b6477339cf98c31ca42bd88ef20f0b8c1290f5.zip
Dont try to move child particles if current particle already dead.
-rw-r--r--src/particle/particle.cpp35
1 files changed, 21 insertions, 14 deletions
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