From 293eda4dc7f7593e67813b5f03d0866dabb5ffa9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Jan 2015 23:05:43 +0300 Subject: Improve setting status stun effects. --- src/statuseffect.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/statuseffect.cpp') 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 &effects = statusEffects[enabling]; + const std::map::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 &effects = stunEffects[enabling]; + const std::map::iterator it = effects.find(index); + if (it != effects.end()) + return (*it).second; + return nullptr; } void StatusEffect::load() -- cgit v1.2.3-60-g2f50