diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-08 20:58:10 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-08 13:48:10 -0700 |
commit | 48c3263aa2540cd895b72edb0337e0717e136e3a (patch) | |
tree | f5b93df0b4bf209e73876161c30ef5fe4a00ff3b /src/particle.cpp | |
parent | 81cdc7b2d880f44df6e0a6de74183f36c53836a0 (diff) | |
download | mana-48c3263aa2540cd895b72edb0337e0717e136e3a.tar.gz mana-48c3263aa2540cd895b72edb0337e0717e136e3a.tar.bz2 mana-48c3263aa2540cd895b72edb0337e0717e136e3a.tar.xz mana-48c3263aa2540cd895b72edb0337e0717e136e3a.zip |
Code reformatting
I wish I had never fallen for this weird style, and I hope removing it
will prevent others from introducing new code like this. :-)
Diffstat (limited to 'src/particle.cpp')
-rw-r--r-- | src/particle.cpp | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/src/particle.cpp b/src/particle.cpp index f1896ae2..fd86195c 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -67,12 +67,21 @@ Particle::Particle(Map *map): mMomentum(1.0f) { Particle::particleCount++; - if (mMap) setSpriteIterator(mMap->addSprite(this)); + if (mMap) + setSpriteIterator(mMap->addSprite(this)); } +Particle::~Particle() +{ + // Remove from map sprite list + if (mMap) + mMap->removeSprite(mSpriteIterator); + // Delete child emitters and child particles + clear(); + Particle::particleCount--; +} -void -Particle::setupEngine() +void Particle::setupEngine() { Particle::maxCount = (int)config.getValue("particleMaxCount", 3000); Particle::fastPhysics = (int)config.getValue("particleFastPhysics", 0); @@ -81,17 +90,17 @@ Particle::setupEngine() logger->log("Particle engine set up"); } -void Particle::draw(Graphics *, int, int) const {} +void Particle::draw(Graphics *, int, int) const +{ +} -bool -Particle::update() +bool Particle::update() { - if (!mMap) return false; + if (!mMap) + return false; if (mLifetimeLeft == 0) - { mAlive = false; - } Vector oldPos = mPos; @@ -221,9 +230,8 @@ Particle::update() return true; } -Particle* -Particle::addEffect(const std::string &particleEffectFile, - int pixelX, int pixelY, int rotation) +Particle* Particle::addEffect(const std::string &particleEffectFile, + int pixelX, int pixelY, int rotation) { Particle *newParticle = NULL; @@ -297,11 +305,9 @@ Particle::addEffect(const std::string &particleEffectFile, return newParticle; } - -Particle* -Particle::addTextSplashEffect(const std::string &text, - int colorR, int colorG, int colorB, - gcn::Font *font, int x, int y) +Particle *Particle::addTextSplashEffect(const std::string &text, + int colorR, int colorG, int colorB, + gcn::Font *font, int x, int y) { Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, font); @@ -319,9 +325,9 @@ Particle::addTextSplashEffect(const std::string &text, return newParticle; } -Particle* -Particle::addTextRiseFadeOutEffect(const std::string &text, gcn::Font *font, - int x, int y) +Particle *Particle::addTextRiseFadeOutEffect(const std::string &text, + gcn::Font *font, + int x, int y) { Particle *newParticle = new TextParticle(mMap, text, 255, 255, 255, font); newParticle->setPosition(x, y, 0); @@ -336,26 +342,14 @@ Particle::addTextRiseFadeOutEffect(const std::string &text, gcn::Font *font, return newParticle; } -void -Particle::setMap(Map *map) +void Particle::setMap(Map *map) { mMap = map; - if (mMap) setSpriteIterator(mMap->addSprite(this)); + if (mMap) + setSpriteIterator(mMap->addSprite(this)); } - -Particle::~Particle() -{ - // Remove from map sprite list - if (mMap) mMap->removeSprite(mSpriteIterator); - // Delete child emitters and child particles - clear(); - Particle::particleCount--; -} - - -void -Particle::clear() +void Particle::clear() { delete_all(mChildEmitters); mChildEmitters.clear(); |