summaryrefslogtreecommitdiff
path: root/src/statuseffect.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-22 23:05:43 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-23 00:19:05 +0300
commit293eda4dc7f7593e67813b5f03d0866dabb5ffa9 (patch)
tree83f5b2ea28d6d55c6b6b3a4beb2b1f1a79553713 /src/statuseffect.cpp
parentb15ba753670a0a1431f4e89acd76163230ebd9e8 (diff)
downloadmv-293eda4dc7f7593e67813b5f03d0866dabb5ffa9.tar.gz
mv-293eda4dc7f7593e67813b5f03d0866dabb5ffa9.tar.bz2
mv-293eda4dc7f7593e67813b5f03d0866dabb5ffa9.tar.xz
mv-293eda4dc7f7593e67813b5f03d0866dabb5ffa9.zip
Improve setting status stun effects.
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r--src/statuseffect.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 7ec1af182..620ed7f29 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -118,14 +118,20 @@ int StatusEffect::blockEffectIndexToEffectIndex(const int blockIndex)
StatusEffect *StatusEffect::getStatusEffect(const int index,
const bool enabling)
{
- // +++ need check
- return statusEffects[enabling][index];
+ std::map<int, StatusEffect *> &effects = statusEffects[enabling];
+ const std::map<int, StatusEffect *>::iterator it = effects.find(index);
+ if (it != effects.end())
+ return (*it).second;
+ return nullptr;
}
StatusEffect *StatusEffect::getStunEffect(const int index, const bool enabling)
{
- // +++ need check
- return stunEffects[enabling][index];
+ std::map<int, StatusEffect *> &effects = stunEffects[enabling];
+ const std::map<int, StatusEffect *>::iterator it = effects.find(index);
+ if (it != effects.end())
+ return (*it).second;
+ return nullptr;
}
void StatusEffect::load()