summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-04 10:00:06 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-04 10:00:06 -0600
commitdcb412dfc87c08f40d3b6841da1b60578665e328 (patch)
tree862187d8b1c5ee993c027ca8831299d0a28ea00a /src
parentd9c38594fcd8c653b95ac6bf8cf525ae21a13195 (diff)
downloadmana-dcb412dfc87c08f40d3b6841da1b60578665e328.tar.gz
mana-dcb412dfc87c08f40d3b6841da1b60578665e328.tar.bz2
mana-dcb412dfc87c08f40d3b6841da1b60578665e328.tar.xz
mana-dcb412dfc87c08f40d3b6841da1b60578665e328.zip
Do some refactoring of Being code
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp18
-rw-r--r--src/being.h16
-rw-r--r--src/monster.cpp2
-rw-r--r--src/player.cpp2
4 files changed, 6 insertions, 32 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 43f0fdef..34f68581 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -83,7 +83,6 @@ Being::Being(int id, int job, Map *map):
mText(0),
mStunMode(0),
mAlpha(1.0f),
- mNumberOfLayers(0),
mStatusParticleEffects(&mStunParticleEffects, false),
mChildParticleEffects(&mStatusParticleEffects, false),
mMustResetParticles(false),
@@ -903,6 +902,11 @@ void Being::showName()
gcn::Graphics::CENTER, mNameColor);
}
+int Being::getNumberOfLayers() const
+{
+ return mSprites.size();
+}
+
void Being::load()
{
// Hairstyles are encoded as negative numbers. Count how far negative
@@ -914,15 +918,3 @@ void Being::load()
mNumberOfHairstyles = hairstyles;
}
-
-void Being::_updateNumberOfLayers()
-{
- SpriteConstIterator si = mSprites.begin();
- mNumberOfLayers = 0;
- while (si != mSprites.end())
- {
- if (*si)
- mNumberOfLayers++;
- si++;
- }
-}
diff --git a/src/being.h b/src/being.h
index 1f9ada92..5869b879 100644
--- a/src/being.h
+++ b/src/being.h
@@ -229,15 +229,7 @@ class Being : public Sprite, public ConfigListener
/**
* Get the number of layers used to draw the being
*/
- int getNumberOfLayers() const
- { return mNumberOfLayers; }
-
- /**
- * Set the number of layers used to draw the being
- */
- void setNumberOfLayers(int numberOfLayers)
- { mNumberOfLayers = numberOfLayers; }
-
+ int getNumberOfLayers() const;
#ifdef EATHENA_SUPPORT
/**
@@ -557,12 +549,6 @@ class Being : public Sprite, public ConfigListener
Sprites mSprites;
float mAlpha; /**< Alpha opacity to draw the sprite */
- /** Stores the number of layers used to draw the being */
- int mNumberOfLayers;
-
- /** This method counts reliably the sprite layers currently used */
- void _updateNumberOfLayers();
-
ParticleList mStunParticleEffects;
ParticleVector mStatusParticleEffects;
ParticleList mChildParticleEffects;
diff --git a/src/monster.cpp b/src/monster.cpp
index 9683e5df..cc2285fe 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -45,14 +45,12 @@ Monster::Monster(int id, int job, Map *map):
{
std::string file = "graphics/sprites/" + *i;
mSprites.push_back(AnimatedSprite::load(file));
- setNumberOfLayers(getNumberOfLayers() + 1);
}
// Ensure that something is shown
if (mSprites.size() == 0)
{
mSprites.push_back(AnimatedSprite::load("graphics/sprites/error.xml"));
- setNumberOfLayers(getNumberOfLayers() + 1);
}
if (mParticleEffects)
diff --git a/src/player.cpp b/src/player.cpp
index d252f7a0..143f3521 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -197,8 +197,6 @@ void Player::setSprite(unsigned int slot, int id, const std::string &color)
mSpriteIDs[slot] = id;
mSpriteColors[slot] = color;
-
- _updateNumberOfLayers();
}
void Player::setSpriteID(unsigned int slot, int id)