summaryrefslogtreecommitdiff
path: root/src/particle
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-13 18:04:01 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-13 18:04:01 +0300
commitc676f4b880ed0abd644085e587e98e3f6ba1c16b (patch)
treea53167ffac4829da9903de9557126dc9206c9f3d /src/particle
parentbcf122e6d80e767bd4546b183f24b46cbbea65f1 (diff)
downloadplus-c676f4b880ed0abd644085e587e98e3f6ba1c16b.tar.gz
plus-c676f4b880ed0abd644085e587e98e3f6ba1c16b.tar.bz2
plus-c676f4b880ed0abd644085e587e98e3f6ba1c16b.tar.xz
plus-c676f4b880ed0abd644085e587e98e3f6ba1c16b.zip
Show particles amount in being popup.
Diffstat (limited to 'src/particle')
-rw-r--r--src/particle/particlelist.cpp7
-rw-r--r--src/particle/particlelist.h4
-rw-r--r--src/particle/particlevector.h3
3 files changed, 13 insertions, 1 deletions
diff --git a/src/particle/particlelist.cpp b/src/particle/particlelist.cpp
index 5e3dc4b5b..0d2a2f195 100644
--- a/src/particle/particlelist.cpp
+++ b/src/particle/particlelist.cpp
@@ -32,7 +32,8 @@ typedef std::list<Particle *>::const_iterator ParticleListCIter;
ParticleList::ParticleList(ParticleContainer *const parent,
const bool delParent) :
ParticleContainer(parent, delParent),
- mElements()
+ mElements(),
+ mSize(0U)
{}
ParticleList::~ParticleList()
@@ -46,6 +47,7 @@ void ParticleList::addLocally(Particle *const particle)
// The effect may not die without the beings permission or we segfault
particle->disableAutoDelete();
mElements.push_back(particle);
+ mSize ++;
}
}
@@ -60,6 +62,7 @@ void ParticleList::removeLocally(const Particle *const particle)
p->kill();
p->prepareToDie();
it = mElements.erase(it);
+ mSize --;
}
else
{
@@ -74,6 +77,7 @@ void ParticleList::clearLocally()
(*it)->kill();
mElements.clear();
+ mSize = 0U;
}
void ParticleList::moveTo(const float x, const float y)
@@ -89,6 +93,7 @@ void ParticleList::moveTo(const float x, const float y)
{
p->kill();
it = mElements.erase(it);
+ mSize --;
}
else
{
diff --git a/src/particle/particlelist.h b/src/particle/particlelist.h
index 3da542b37..6d27903cd 100644
--- a/src/particle/particlelist.h
+++ b/src/particle/particlelist.h
@@ -58,8 +58,12 @@ class ParticleList final : public ParticleContainer
void moveTo(const float x, const float y) override final;
+ size_t size() const
+ { return mSize; }
+
protected:
std::list<Particle *> mElements; /**< Contained particle effects */
+ size_t mSize;
};
#endif // PARTICLE_PARTICLELIST_H
diff --git a/src/particle/particlevector.h b/src/particle/particlevector.h
index 8804991be..68589e4e1 100644
--- a/src/particle/particlevector.h
+++ b/src/particle/particlevector.h
@@ -59,6 +59,9 @@ class ParticleVector final : public ParticleContainer
void moveTo(const float x, const float y) override final;
+ size_t size() const
+ { return mIndexedElements.size(); }
+
protected:
std::vector<Particle *> mIndexedElements;
};