diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-08 00:30:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-08 00:30:16 +0300 |
commit | 5d78828e2970841d908c6fc2f8595f1606137154 (patch) | |
tree | c59084c09f31ce80a9662255ed1b775c3e416052 /src | |
parent | ea407dcf7f05a00224a1e3fdabf1273a4a60b0df (diff) | |
download | plus-5d78828e2970841d908c6fc2f8595f1606137154.tar.gz plus-5d78828e2970841d908c6fc2f8595f1606137154.tar.bz2 plus-5d78828e2970841d908c6fc2f8595f1606137154.tar.xz plus-5d78828e2970841d908c6fc2f8595f1606137154.zip |
Fix particles counter in being popup.evolrelease2016-08-07
Diffstat (limited to 'src')
-rw-r--r-- | src/being/actorsprite.h | 2 | ||||
-rw-r--r-- | src/particle/particlevector.cpp | 12 | ||||
-rw-r--r-- | src/particle/particlevector.h | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index c06f1c983..5373b30dc 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -191,7 +191,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor size_t getParticlesCount() const { - return mStatusParticleEffects.size() + + return mStatusParticleEffects.usedSize() + mChildParticleEffects.size(); } diff --git a/src/particle/particlevector.cpp b/src/particle/particlevector.cpp index d0594a2dd..a38db6d01 100644 --- a/src/particle/particlevector.cpp +++ b/src/particle/particlevector.cpp @@ -95,3 +95,15 @@ void ParticleVector::moveTo(const float x, const float y) } } } + +size_t ParticleVector::usedSize() const +{ + size_t cnt = 0; + for (std::vector<Particle *>::const_iterator it = mIndexedElements.begin(); + it != mIndexedElements.end(); ++it) + { + if (*it) + cnt ++; + } + return cnt; +} diff --git a/src/particle/particlevector.h b/src/particle/particlevector.h index 68589e4e1..d8ec917c9 100644 --- a/src/particle/particlevector.h +++ b/src/particle/particlevector.h @@ -62,6 +62,8 @@ class ParticleVector final : public ParticleContainer size_t size() const { return mIndexedElements.size(); } + size_t usedSize() const; + protected: std::vector<Particle *> mIndexedElements; }; |