summaryrefslogtreecommitdiff
path: root/src/actorsprite.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-05 03:26:24 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-05 03:26:24 +0300
commitf6920653c7a958528df248ff61c372a0bd3d4f1d (patch)
tree7a6b035e735eab7c3e3e940295f31aea6358b88d /src/actorsprite.cpp
parent370d1c43e73d4c06aabb4432b61e772ba6a66f13 (diff)
downloadmv-f6920653c7a958528df248ff61c372a0bd3d4f1d.tar.gz
mv-f6920653c7a958528df248ff61c372a0bd3d4f1d.tar.bz2
mv-f6920653c7a958528df248ff61c372a0bd3d4f1d.tar.xz
mv-f6920653c7a958528df248ff61c372a0bd3d4f1d.zip
Add missing checks and consts.
Diffstat (limited to 'src/actorsprite.cpp')
-rw-r--r--src/actorsprite.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index b0ed43b75..be7fcb165 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -221,7 +221,11 @@ static EffectDescription *getEffectDescription(const int effectId)
effects_initialized = true;
} // done initializing
- EffectDescription *const ed = effects[effectId];
+ std::map<int, EffectDescription *>::iterator it = effects.find(effectId);
+ if (it == effects.end())
+ return default_effect;
+
+ EffectDescription *const ed = (*it).second;
return ed ? ed : default_effect;
}
@@ -274,12 +278,7 @@ void ActorSprite::internalTriggerEffect(const int effectId, const bool sfx,
}
if (gfx && !ed->mGFXEffect.empty())
- {
- Particle *selfFX;
-
- selfFX = particleEngine->addEffect(ed->mGFXEffect, 0, 0);
- controlParticle(selfFX);
- }
+ controlParticle(particleEngine->addEffect(ed->mGFXEffect, 0, 0));
if (sfx && !ed->mSFXEffect.empty())
sound.playSfx(ed->mSFXEffect);
@@ -325,7 +324,7 @@ void ActorSprite::handleStatusEffect(StatusEffect *const effect,
void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
const bool forceDisplay,
const int imageType,
- std::string color)
+ const std::string &color)
{
clear();
@@ -333,7 +332,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
{
if (!*it)
continue;
- std::string file = paths.getStringValue("sprites")
+ const std::string file = paths.getStringValue("sprites")
+ combineDye2((*it)->sprite, color);
const int variant = (*it)->variant;