diff options
Diffstat (limited to 'src/particlecontainer.cpp')
-rw-r--r-- | src/particlecontainer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp index 54a7b315..ddd99ff2 100644 --- a/src/particlecontainer.cpp +++ b/src/particlecontainer.cpp @@ -24,7 +24,8 @@ #include "particlecontainer.h" -ParticleContainer::ParticleContainer(ParticleContainer *parent, bool delParent): +ParticleContainer::ParticleContainer(ParticleContainer *parent, + bool delParent): mDelParent(delParent), mNext(parent) {} @@ -32,7 +33,7 @@ ParticleContainer::ParticleContainer(ParticleContainer *parent, bool delParent): ParticleContainer::~ParticleContainer() { clearLocally(); - if (mNext && mDelParent) + if (mDelParent) delete mNext; } @@ -52,11 +53,12 @@ void ParticleContainer::setPositions(float x, float y) // -- particle list ---------------------------------------- -ParticleList::ParticleList(ParticleContainer *parent, bool delParent) : +ParticleList::ParticleList(ParticleContainer *parent, bool delParent): ParticleContainer(parent, delParent) {} -ParticleList::~ParticleList() {} +ParticleList::~ParticleList() +{} void ParticleList::addLocally(Particle *particle) { @@ -72,10 +74,12 @@ void ParticleList::removeLocally(Particle *particle) { for (std::list<Particle *>::iterator it = mElements.begin(); it != mElements.end(); it++) + { if (*it == particle) { (*it)->kill(); mElements.erase(it); } + } } void ParticleList::clearLocally() |