summaryrefslogtreecommitdiff
path: root/src/being/actorsprite.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-06 18:37:06 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-06 18:37:06 +0300
commitc25141f02a5b3dcddcc93ca5d2bd2fcdad5efb31 (patch)
treeac124c630bc17ef10a8885a49fbb387f7091d15d /src/being/actorsprite.cpp
parent88697bc3503090194877b241b987ddc751034166 (diff)
downloadmanaplus-c25141f02a5b3dcddcc93ca5d2bd2fcdad5efb31.tar.gz
manaplus-c25141f02a5b3dcddcc93ca5d2bd2fcdad5efb31.tar.bz2
manaplus-c25141f02a5b3dcddcc93ca5d2bd2fcdad5efb31.tar.xz
manaplus-c25141f02a5b3dcddcc93ca5d2bd2fcdad5efb31.zip
Add strong typed bool type Enable.
Diffstat (limited to 'src/being/actorsprite.cpp')
-rw-r--r--src/being/actorsprite.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 88418be1a..b305b35a7 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -120,9 +120,9 @@ void ActorSprite::logic()
FOR_EACH (std::set<int>::const_iterator, it, mStatusEffects)
{
const StatusEffect *const effect
- = StatusEffect::getStatusEffect(*it, true);
+ = StatusEffect::getStatusEffect(*it, Enable_true);
if (effect && effect->particleEffectIsPersistent())
- updateStatusEffect(*it, true);
+ updateStatusEffect(*it, Enable_true);
}
}
@@ -174,14 +174,15 @@ struct EffectDescription final
std::string mSFXEffect;
};
-void ActorSprite::setStatusEffect(const int index, const bool active)
+void ActorSprite::setStatusEffect(const int index, const Enable active)
{
- const bool wasActive = mStatusEffects.find(index) != mStatusEffects.end();
+ const Enable wasActive = fromBool(
+ mStatusEffects.find(index) != mStatusEffects.end(), Enable);
if (active != wasActive)
{
updateStatusEffect(index, active);
- if (active)
+ if (active == Enable_true)
mStatusEffects.insert(index);
else
mStatusEffects.erase(index);
@@ -197,28 +198,33 @@ void ActorSprite::setStatusEffectBlock(const int offset,
offset + i);
if (index != -1)
- setStatusEffect(index, (newEffects & (1 << i)) > 0);
+ {
+ setStatusEffect(index,
+ fromBool((newEffects & (1 << i)) > 0, Enable));
+ }
}
}
void ActorSprite::updateStunMode(const int oldMode, const int newMode)
{
- handleStatusEffect(StatusEffect::getStatusEffect(oldMode, false), -1);
- handleStatusEffect(StatusEffect::getStatusEffect(newMode, true), -1);
+ handleStatusEffect(StatusEffect::getStatusEffect(
+ oldMode, Enable_false), -1);
+ handleStatusEffect(StatusEffect::getStatusEffect(
+ newMode, Enable_true), -1);
}
-void ActorSprite::updateStatusEffect(const int index, const bool newStatus)
+void ActorSprite::updateStatusEffect(const int index, const Enable newStatus)
{
StatusEffect *const effect = StatusEffect::getStatusEffect(
index, newStatus);
if (!effect)
return;
if (effect->isPoison() && getType() == ActorType::Player)
- setPoison(newStatus);
+ setPoison(newStatus == Enable_true);
else if (effect->isCart() && localPlayer == this)
- setHaveCart(newStatus);
+ setHaveCart(newStatus == Enable_true);
else if (effect->isRiding())
- setRiding(newStatus);
+ setRiding(newStatus == Enable_true);
handleStatusEffect(effect, index);
}