From 753f7335b3eb5a6637611045bd1a5d4238a47e12 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 30 Sep 2016 20:10:30 +0300 Subject: Fix removing particle effects after end effect message. --- src/being/actorsprite.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'src/being/actorsprite.cpp') diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 56b21288d..c6346c721 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -208,9 +208,13 @@ void ActorSprite::setStatusEffect(const int32_t index, { updateStatusEffect(index, active, start); if (active == Enable_true) + { mStatusEffects.insert(index); + } else + { mStatusEffects.erase(index); + } } } @@ -390,25 +394,33 @@ void ActorSprite::updateStatusEffect(const int32_t index, setTrickDead(newStatus == Enable_true); else if (effect->mIsPostDelay) stopCast(newStatus == Enable_true); - handleStatusEffect(effect, index, start); + handleStatusEffect(effect, index, newStatus, start); } void ActorSprite::handleStatusEffect(const StatusEffect *const effect, const int32_t effectId, + const Enable newStatus, const IsStart start) { - if (!effect) + if (effect == nullptr) return; - if (effectId >= 0) + if (newStatus == Enable_true) + { + if (effectId >= 0) + { + Particle *particle = nullptr; + if (start == IsStart_true) + particle = effect->getStartParticle(); + if (!particle) + particle = effect->getParticle(); + if (particle) + mStatusParticleEffects.setLocally(effectId, particle); + } + } + else { - Particle *particle = nullptr; - if (start == IsStart_true) - particle = effect->getStartParticle(); - if (!particle) - particle = effect->getParticle(); - if (particle) - mStatusParticleEffects.setLocally(effectId, particle); + mStatusParticleEffects.delLocally(effectId); } } -- cgit v1.2.3-60-g2f50