diff options
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/actorsprite.cpp | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 3beb5b9d2..25a118f88 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -124,9 +124,7 @@ void ActorSprite::logic() if (effect != nullptr && effect->mIsPersistent) { - updateStatusEffect(*it, - Enable_true, - IsStart_false); + updateStatusEffect(*it, Enable_true, IsStart_false); } } } @@ -228,9 +226,7 @@ static void applyEffectByOption(ActorSprite *const actor, const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false; option |= opt; option ^= opt; - actor->setStatusEffect(id, - enable, - IsStart_false); + actor->setStatusEffect(id, enable, IsStart_false); } if (option != 0U && config.getBoolValue("unimplimentedLog")) @@ -240,8 +236,8 @@ static void applyEffectByOption(ActorSprite *const actor, "Left value: %u", name, option); - logger->log(str); - DebugMessageListener::distributeEvent(str); + logger->log(str); + DebugMessageListener::distributeEvent(str); } } @@ -256,16 +252,12 @@ static void applyEffectByOption1(ActorSprite *const actor, const int32_t id = (*it).second; if (opt == option) { - actor->setStatusEffect(id, - Enable_true, - IsStart_false); + actor->setStatusEffect(id, Enable_true, IsStart_false); option = 0U; } else { - actor->setStatusEffect(id, - Enable_false, - IsStart_false); + actor->setStatusEffect(id, Enable_false, IsStart_false); } } if (option != 0 && @@ -276,8 +268,8 @@ static void applyEffectByOption1(ActorSprite *const actor, "Left value: %u", name, option); - logger->log(str); - DebugMessageListener::distributeEvent(str); + logger->log(str); + DebugMessageListener::distributeEvent(str); } } @@ -318,8 +310,9 @@ void ActorSprite::updateStatusEffect(const int32_t index, const Enable newStatus, const IsStart start) { - StatusEffect *const effect = StatusEffectDB::getStatusEffect( - index, newStatus); + StatusEffect *const effect + = StatusEffectDB::getStatusEffect(index, newStatus); + if (effect == nullptr) return; if (effect->mIsPoison && getType() == ActorType::Player) @@ -385,9 +378,10 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, { if (display.image.empty()) { - addSprite(AnimatedSprite::delayedLoad(pathJoin( - paths.getStringValue("sprites"), - paths.getStringValue("spriteErrorFile")), + addSprite(AnimatedSprite::delayedLoad( + pathJoin( + paths.getStringValue("sprites"), + paths.getStringValue("spriteErrorFile")), 0)); } else @@ -524,10 +518,9 @@ std::string ActorSprite::getStatusEffectsString() const { FOR_EACH (std::set<int32_t>::const_iterator, it, mStatusEffects) { - const StatusEffect *const effect = - StatusEffectDB::getStatusEffect( - *it, - Enable_true); + const StatusEffect *const effect + = StatusEffectDB::getStatusEffect(*it, Enable_true); + if (effect == nullptr) continue; if (!effectsStr.empty()) |