diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:21:43 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-29 14:18:06 +0100 |
commit | e7c285e3423ddd660447f6a6fc6bbae25f99f386 (patch) | |
tree | 1d700f09a5e96a2a0d390af30581097bdec0bf77 /src/particle.cpp | |
parent | e1a7c1d0ca30c2c4a293ffbff6b9c51c881d23e3 (diff) | |
download | mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.gz mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.bz2 mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.xz mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.zip |
Apply C++11 fixits
modernize-loop-convert
modernize-deprecated-headers
Diffstat (limited to 'src/particle.cpp')
-rw-r--r-- | src/particle.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/particle.cpp b/src/particle.cpp index 64f25999..5edb11e1 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -195,15 +195,13 @@ bool Particle::update() // Update child emitters if ((mLifetimePast-1)%Particle::emitterSkip == 0) { - for (auto e = mChildEmitters.begin(); - e != mChildEmitters.end(); e++) + for (auto &childEmitter : mChildEmitters) { - Particles newParticles = (*e)->createParticles(mLifetimePast); - for (auto p = newParticles.begin(); - p != newParticles.end(); p++) + Particles newParticles = childEmitter->createParticles(mLifetimePast); + for (auto &newParticle : newParticles) { - (*p)->moveBy(mPos); - mChildParticles.push_back (*p); + newParticle->moveBy(mPos); + mChildParticles.push_back(newParticle); } } } @@ -212,7 +210,7 @@ bool Particle::update() // create death effect when the particle died if (mAlive != ALIVE && mAlive != DEAD_LONG_AGO) { - if ((mAlive & mDeathEffectConditions) > 0x00 && !mDeathEffect.empty()) + if ((mAlive & mDeathEffectConditions) > 0x00 && !mDeathEffect.empty()) { Particle* deathEffect = particleEngine->addEffect(mDeathEffect, 0, 0); deathEffect->moveBy(mPos); @@ -254,12 +252,11 @@ bool Particle::update() void Particle::moveBy(const Vector &change) { mPos += change; - for (auto p = mChildParticles.begin(); - p != mChildParticles.end(); p++) + for (auto &childParticle : mChildParticles) { - if ((*p)->doesFollow()) + if (childParticle->doesFollow()) { - (*p)->moveBy(change); + childParticle->moveBy(change); } } } @@ -432,10 +429,9 @@ void Particle::adjustEmitterSize(int w, int h) { if (mAllowSizeAdjust) { - for (auto e = mChildEmitters.begin(); - e != mChildEmitters.end(); e++) + for (auto &childEmitter : mChildEmitters) { - (*e)->adjustSize(w, h); + childEmitter->adjustSize(w, h); } } } |