diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-02 17:26:44 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-03-02 17:27:39 +0100 |
commit | 72ceaaa426166bfa425f519c2418a66872839e12 (patch) | |
tree | 1ce7253fc629d4df445b89b2f533899341f03fc5 /src/statuseffect.cpp | |
parent | 78d6d9352f66f41963207b04a999d94c17d67cf2 (diff) | |
download | mana-72ceaaa426166bfa425f519c2418a66872839e12.tar.gz mana-72ceaaa426166bfa425f519c2418a66872839e12.tar.bz2 mana-72ceaaa426166bfa425f519c2418a66872839e12.tar.xz mana-72ceaaa426166bfa425f519c2418a66872839e12.zip |
Changed server type to "enum class"
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r-- | src/statuseffect.cpp | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 42b48783..004e2f66 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -22,7 +22,6 @@ #include "statuseffect.h" #include "event.h" -#include "log.h" #include "sound.h" #include "configuration.h" @@ -33,12 +32,8 @@ bool StatusEffect::mLoaded = false; -StatusEffect::StatusEffect() : - mPersistentParticleEffect(false) -{} - -StatusEffect::~StatusEffect() -{} +StatusEffect::StatusEffect() = default; +StatusEffect::~StatusEffect() = default; void StatusEffect::playSFX() { @@ -56,33 +51,29 @@ Particle *StatusEffect::getParticle() { if (mParticleEffect.empty()) return nullptr; - else - return particleEngine->addEffect(mParticleEffect, 0, 0); + return particleEngine->addEffect(mParticleEffect, 0, 0); } AnimatedSprite *StatusEffect::getIcon() { if (mIcon.empty()) return nullptr; - else + + AnimatedSprite *sprite = AnimatedSprite::load( + paths.getStringValue("sprites") + mIcon); + if (false && sprite) { - AnimatedSprite *sprite = AnimatedSprite::load( - paths.getStringValue("sprites") + mIcon); - if (false && sprite) - { - sprite->play(SpriteAction::DEFAULT); - sprite->reset(); - } - return sprite; + sprite->play(SpriteAction::DEFAULT); + sprite->reset(); } + return sprite; } -std::string StatusEffect::getAction() +std::string StatusEffect::getAction() const { if (mAction.empty()) return SpriteAction::INVALID; - else - return mAction; + return mAction; } @@ -162,10 +153,8 @@ void StatusEffect::checkStatus() void unloadMap(std::map<int, StatusEffect *> map) { - std::map<int, StatusEffect *>::iterator it; - - for (it = map.begin(); it != map.end(); it++) - delete (*it).second; + for (auto &[_, effect] : map) + delete effect; map.clear(); } |