summaryrefslogtreecommitdiff
path: root/src/particlecontainer.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-07 03:14:31 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-12-07 13:45:44 +0100
commitb9cacafcad8b515c1c65aee804a3ce08411b73c9 (patch)
tree8a82fabf08b322de8b31b97bc356caccc33f90f6 /src/particlecontainer.cpp
parent3fcd6a549fc825f4185a6dc248922e02988caed5 (diff)
downloadmana-b9cacafcad8b515c1c65aee804a3ce08411b73c9.tar.gz
mana-b9cacafcad8b515c1c65aee804a3ce08411b73c9.tar.bz2
mana-b9cacafcad8b515c1c65aee804a3ce08411b73c9.tar.xz
mana-b9cacafcad8b515c1c65aee804a3ce08411b73c9.zip
Some small updates and reformatting
Diffstat (limited to 'src/particlecontainer.cpp')
-rw-r--r--src/particlecontainer.cpp50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index f7672eac..54a7b315 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -24,10 +24,10 @@
#include "particlecontainer.h"
-ParticleContainer::ParticleContainer(ParticleContainer *parent, bool delParent) :
+ParticleContainer::ParticleContainer(ParticleContainer *parent, bool delParent):
mDelParent(delParent),
mNext(parent)
-{};
+{}
ParticleContainer::~ParticleContainer()
{
@@ -36,8 +36,7 @@ ParticleContainer::~ParticleContainer()
delete mNext;
}
-void
-ParticleContainer::clear()
+void ParticleContainer::clear()
{
clearLocally();
if (mNext)
@@ -45,8 +44,7 @@ ParticleContainer::clear()
}
-void
-ParticleContainer::setPositions(float x, float y)
+void ParticleContainer::setPositions(float x, float y)
{
if (mNext)
mNext->setPositions(x, y);
@@ -55,12 +53,12 @@ ParticleContainer::setPositions(float x, float y)
// -- particle list ----------------------------------------
ParticleList::ParticleList(ParticleContainer *parent, bool delParent) :
- ParticleContainer(parent, delParent) {};
+ ParticleContainer(parent, delParent)
+{}
ParticleList::~ParticleList() {}
-void
-ParticleList::addLocally(Particle *particle)
+void ParticleList::addLocally(Particle *particle)
{
if (particle)
{
@@ -70,8 +68,7 @@ ParticleList::addLocally(Particle *particle)
}
}
-void
-ParticleList::removeLocally(Particle *particle)
+void ParticleList::removeLocally(Particle *particle)
{
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end(); it++)
@@ -81,18 +78,16 @@ ParticleList::removeLocally(Particle *particle)
}
}
-void
-ParticleList::clearLocally()
+void ParticleList::clearLocally()
{
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end(); it++)
(*it)->kill();
-
+
mElements.clear();
}
-void
-ParticleList::setPositions(float x, float y)
+void ParticleList::setPositions(float x, float y)
{
ParticleContainer::setPositions(x, y);
@@ -115,13 +110,14 @@ ParticleList::setPositions(float x, float y)
// -- particle vector ----------------------------------------
-ParticleVector::ParticleVector(ParticleContainer *parent, bool delParent) :
- ParticleContainer(parent, delParent) {};
+ParticleVector::ParticleVector(ParticleContainer *parent, bool delParent):
+ ParticleContainer(parent, delParent)
+{}
-ParticleVector::~ParticleVector() {};
+ParticleVector::~ParticleVector()
+{}
-void
-ParticleVector::setLocally(int index, Particle *particle)
+void ParticleVector::setLocally(int index, Particle *particle)
{
assert(index >= 0);
@@ -134,8 +130,7 @@ ParticleVector::setLocally(int index, Particle *particle)
mIndexedElements[index] = particle;
}
-void
-ParticleVector::delLocally(int index)
+void ParticleVector::delLocally(int index)
{
assert(index >= 0);
@@ -150,20 +145,18 @@ ParticleVector::delLocally(int index)
}
}
-void
-ParticleVector::clearLocally()
+void ParticleVector::clearLocally()
{
for (unsigned int i = 0; i < mIndexedElements.size(); i++)
delLocally(i);
}
-void
-ParticleVector::setPositions(float x, float y)
+void ParticleVector::setPositions(float x, float y)
{
ParticleContainer::setPositions(x, y);
for (std::vector<Particle *>::iterator it = mIndexedElements.begin();
- it != mIndexedElements.end(); it++)
+ it != mIndexedElements.end(); it++) {
if (*it)
{
(*it)->setPosition(x, y);
@@ -174,5 +167,6 @@ ParticleVector::setPositions(float x, float y)
*it = NULL;
}
}
+ }
}