diff options
Diffstat (limited to 'src/particle')
-rw-r--r-- | src/particle/particlevector.cpp | 12 | ||||
-rw-r--r-- | src/particle/particlevector.h | 2 |
2 files changed, 14 insertions, 0 deletions
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; }; |