diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-19 20:15:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-19 20:15:51 +0300 |
commit | 2cf3c1e9938d64fe7b2cf1cffca0ec8b12970e80 (patch) | |
tree | 8d4599be8c7883213d9da4f31d2a6bdda183f680 /src/particle/particle.cpp | |
parent | d07f27c128e946b49971f4d3d9e6dfec81ce2b8b (diff) | |
download | manaplus-2cf3c1e9938d64fe7b2cf1cffca0ec8b12970e80.tar.gz manaplus-2cf3c1e9938d64fe7b2cf1cffca0ec8b12970e80.tar.bz2 manaplus-2cf3c1e9938d64fe7b2cf1cffca0ec8b12970e80.tar.xz manaplus-2cf3c1e9938d64fe7b2cf1cffca0ec8b12970e80.zip |
Move child particles only if current particle changed position.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r-- | src/particle/particle.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index b28e3a819..728433ae9 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -237,11 +237,19 @@ bool Particle::update() restrict2 { if (mAlive == AliveStatus::ALIVE) { - const Vector oldPos = mPos; - if (mLifetimeLeft == 0) { mAlive = AliveStatus::DEAD_TIMEOUT; + + if (mChildParticles.empty()) + { + if (mAlive != AliveStatus::ALIVE && + mAutoDelete) + { + return false; + } + return true; + } } else { @@ -289,24 +297,26 @@ bool Particle::update() restrict2 } mImage = mAnimation->getCurrentImage(); } + const Vector oldPos = mPos; + 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; ) - { - // move particle with its parent if desired - (*p)->moveBy(change); } // Update child particles |