diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-18 20:03:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-18 20:03:06 +0300 |
commit | c8e22bbb7cc1531b09b994e06a58fd8c4664b7bb (patch) | |
tree | e8d4180c64aada75021673c4b6ef97c7aeedbeeb /src/particle/particlecontainer.cpp | |
parent | 7da95c7f4da447876458a0b1a17736b9a2865844 (diff) | |
download | mv-c8e22bbb7cc1531b09b994e06a58fd8c4664b7bb.tar.gz mv-c8e22bbb7cc1531b09b994e06a58fd8c4664b7bb.tar.bz2 mv-c8e22bbb7cc1531b09b994e06a58fd8c4664b7bb.tar.xz mv-c8e22bbb7cc1531b09b994e06a58fd8c4664b7bb.zip |
Move particlelist into separate file.
Diffstat (limited to 'src/particle/particlecontainer.cpp')
-rw-r--r-- | src/particle/particlecontainer.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/particle/particlecontainer.cpp b/src/particle/particlecontainer.cpp index 52179bce8..68e0c9d6c 100644 --- a/src/particle/particlecontainer.cpp +++ b/src/particle/particlecontainer.cpp @@ -27,9 +27,6 @@ #include "debug.h" -typedef std::list<Particle *>::iterator ParticleListIter; -typedef std::list<Particle *>::const_iterator ParticleListCIter; - ParticleContainer::ParticleContainer(ParticleContainer *const parent, const bool delParent): mNext(parent), @@ -58,74 +55,6 @@ void ParticleContainer::moveTo(const float x, const float y) mNext->moveTo(x, y); } -// -- particle list ---------------------------------------- - -ParticleList::ParticleList(ParticleContainer *const parent, - const bool delParent) : - ParticleContainer(parent, delParent), - mElements() -{} - -ParticleList::~ParticleList() -{} - -void ParticleList::addLocally(Particle *const particle) -{ - if (particle) - { - // The effect may not die without the beings permission or we segfault - particle->disableAutoDelete(); - mElements.push_back(particle); - } -} - -void ParticleList::removeLocally(const Particle *const particle) -{ - for (std::list<Particle *>::iterator it = mElements.begin(); - it != mElements.end(); ) - { - Particle *const p = *it; - if (p == particle) - { - p->kill(); - it = mElements.erase(it); - } - else - { - ++it; - } - } -} - -void ParticleList::clearLocally() -{ - FOR_EACH (ParticleListCIter, it, mElements) - (*it)->kill(); - - mElements.clear(); -} - -void ParticleList::moveTo(const float x, const float y) -{ - ParticleContainer::moveTo(x, y); - - for (std::list<Particle *>::iterator it = mElements.begin(); - it != mElements.end(); ) - { - Particle *const p = *it; - p->moveTo(x, y); - if (p->isExtinct()) - { - p->kill(); - it = mElements.erase(it); - } - else - { - ++it; - } - } -} - // -- particle vector ---------------------------------------- ParticleVector::ParticleVector(ParticleContainer *const parent, |