summaryrefslogtreecommitdiff
path: root/src/statuseffect.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-02 17:26:44 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-02 17:27:39 +0100
commit72ceaaa426166bfa425f519c2418a66872839e12 (patch)
tree1ce7253fc629d4df445b89b2f533899341f03fc5 /src/statuseffect.cpp
parent78d6d9352f66f41963207b04a999d94c17d67cf2 (diff)
downloadmana-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.cpp39
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();
}