summaryrefslogtreecommitdiff
path: root/src/statuseffect.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-03 21:58:08 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-04 03:06:57 +0300
commit866a71ffd576fd10c4e309195016d86f0c8ed635 (patch)
tree21bbec175afc181cada529598267d62f12fcb671 /src/statuseffect.cpp
parentebecb0cf42f2066943908fa158ac91527e0e6629 (diff)
downloadmv-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.gz
mv-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.bz2
mv-866a71ffd576fd10c4e309195016d86f0c8ed635.tar.xz
mv-866a71ffd576fd10c4e309195016d86f0c8ed635.zip
Add const to more classes.
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r--src/statuseffect.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 0855d2c9b..4b86de2fc 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -48,19 +48,19 @@ StatusEffect::~StatusEffect()
{
}
-void StatusEffect::playSFX()
+void StatusEffect::playSFX() const
{
if (!mSFXEffect.empty())
sound.playSfx(mSFXEffect);
}
-void StatusEffect::deliverMessage()
+void StatusEffect::deliverMessage() const
{
if (!mMessage.empty() && localChatTab)
localChatTab->chatLog(mMessage, BY_SERVER);
}
-Particle *StatusEffect::getParticle()
+Particle *StatusEffect::getParticle() const
{
if (!particleEngine || mParticleEffect.empty())
return nullptr;
@@ -68,7 +68,7 @@ Particle *StatusEffect::getParticle()
return particleEngine->addEffect(mParticleEffect, 0, 0);
}
-AnimatedSprite *StatusEffect::getIcon()
+AnimatedSprite *StatusEffect::getIcon() const
{
if (mIcon.empty())
{
@@ -76,7 +76,7 @@ AnimatedSprite *StatusEffect::getIcon()
}
else
{
- AnimatedSprite *sprite = AnimatedSprite::load(
+ AnimatedSprite *const sprite = AnimatedSprite::load(
paths.getStringValue("sprites") + mIcon);
if (false && sprite)
{
@@ -87,7 +87,7 @@ AnimatedSprite *StatusEffect::getIcon()
}
}
-std::string StatusEffect::getAction()
+std::string StatusEffect::getAction() const
{
if (mAction.empty())
return SpriteAction::INVALID;
@@ -105,19 +105,20 @@ static status_effect_map statusEffects;
static status_effect_map stunEffects;
static std::map<int, int> blockEffectIndexMap;
-int StatusEffect::blockEffectIndexToEffectIndex(int blockIndex)
+int StatusEffect::blockEffectIndexToEffectIndex(const int blockIndex)
{
if (blockEffectIndexMap.find(blockIndex) == blockEffectIndexMap.end())
return -1;
return blockEffectIndexMap[blockIndex];
}
-StatusEffect *StatusEffect::getStatusEffect(int index, bool enabling)
+StatusEffect *StatusEffect::getStatusEffect(const int index,
+ const bool enabling)
{
return statusEffects[enabling][index];
}
-StatusEffect *StatusEffect::getStunEffect(int index, bool enabling)
+StatusEffect *StatusEffect::getStunEffect(const int index, const bool enabling)
{
return stunEffects[enabling][index];
}
@@ -128,7 +129,7 @@ void StatusEffect::load()
unload();
XML::Document doc(STATUS_EFFECTS_FILE);
- XmlNodePtr rootNode = doc.rootNode();
+ const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "status-effects"))
{
@@ -140,12 +141,12 @@ void StatusEffect::load()
{
status_effect_map *the_map = nullptr;
- int index = atoi(XML::getProperty(node, "id", "-1").c_str());
+ const int index = atoi(XML::getProperty(node, "id", "-1").c_str());
if (xmlNameEqual(node, "status-effect"))
{
the_map = &statusEffects;
- int block_index = atoi(XML::getProperty(
+ const int block_index = atoi(XML::getProperty(
node, "block-id", "-1").c_str());
if (index >= 0 && block_index >= 0)
@@ -159,8 +160,8 @@ void StatusEffect::load()
if (the_map)
{
- StatusEffect *startEffect = new StatusEffect;
- StatusEffect *endEffect = new StatusEffect;
+ StatusEffect *const startEffect = new StatusEffect;
+ StatusEffect *const endEffect = new StatusEffect;
startEffect->mMessage = XML::getProperty(
node, "start-message", "");