diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-30 20:10:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-30 20:21:39 +0300 |
commit | 753f7335b3eb5a6637611045bd1a5d4238a47e12 (patch) | |
tree | 81e47e0380e1af058a8ab01aa014c6cfbbbb5ed3 | |
parent | 205ed1edc60277c6ae8cc4383ab24535b36f7761 (diff) | |
download | manaplus-753f7335b3eb5a6637611045bd1a5d4238a47e12.tar.gz manaplus-753f7335b3eb5a6637611045bd1a5d4238a47e12.tar.bz2 manaplus-753f7335b3eb5a6637611045bd1a5d4238a47e12.tar.xz manaplus-753f7335b3eb5a6637611045bd1a5d4238a47e12.zip |
Fix removing particle effects after end effect message.
-rw-r--r-- | src/being/actorsprite.cpp | 32 | ||||
-rw-r--r-- | src/being/actorsprite.h | 1 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 2 | ||||
-rw-r--r-- | src/being/localplayer.h | 1 |
4 files changed, 26 insertions, 10 deletions
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); } } diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index 5f5bcbe5d..4e6d38b73 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -223,6 +223,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor */ virtual void handleStatusEffect(const StatusEffect *const effect, const int32_t effectId, + const Enable newStatus, const IsStart start); void setupSpriteDisplay(const SpriteDisplay &display, diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index a385cf0f7..23186dc2c 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -1004,10 +1004,12 @@ void LocalPlayer::setGotoTarget(Being *const target) void LocalPlayer::handleStatusEffect(const StatusEffect *const effect, const int32_t effectId, + const Enable newStatus, const IsStart start) { Being::handleStatusEffect(effect, effectId, + newStatus, start); if (effect) diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 72c4d7258..7a3985a32 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -437,6 +437,7 @@ class LocalPlayer final : public Being, void handleStatusEffect(const StatusEffect *const effect, const int32_t effectId, + const Enable newStatus, const IsStart start) override final; void startWalking(const unsigned char dir); |