summaryrefslogtreecommitdiff
path: root/src/compoundsprite.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-23 00:00:43 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-23 00:00:43 +0300
commitc4e562fffe134b86a35800dbe906afcf761879bc (patch)
treef6884b020d29745a2e9c859372c058d67476b6bc /src/compoundsprite.cpp
parenta3ecadac89eafbacd0c6b3764d5977bcac242c57 (diff)
downloadManaVerse-c4e562fffe134b86a35800dbe906afcf761879bc.tar.gz
ManaVerse-c4e562fffe134b86a35800dbe906afcf761879bc.tar.bz2
ManaVerse-c4e562fffe134b86a35800dbe906afcf761879bc.tar.xz
ManaVerse-c4e562fffe134b86a35800dbe906afcf761879bc.zip
add const and some minor changes in compoundsprite class.
Diffstat (limited to 'src/compoundsprite.cpp')
-rw-r--r--src/compoundsprite.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index 01e144bf4..7f7e554a9 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -66,23 +66,18 @@ CompoundSprite::CompoundSprite() :
CompoundSprite::~CompoundSprite()
{
clear();
-
-// delete mImage;
mImage = nullptr;
-// delete mAlphaImage;
mAlphaImage = nullptr;
}
bool CompoundSprite::reset()
{
bool ret = false;
-
FOR_EACH (SpriteIterator, it, mSprites)
{
if (*it)
ret |= (*it)->reset();
}
-
mNeedsRedraw |= ret;
return ret;
}
@@ -90,13 +85,11 @@ bool CompoundSprite::reset()
bool CompoundSprite::play(const std::string &action)
{
bool ret = false;
-
FOR_EACH (SpriteIterator, it, mSprites)
{
if (*it)
ret |= (*it)->play(action);
}
-
mNeedsRedraw |= ret;
return ret;
}
@@ -104,13 +97,11 @@ bool CompoundSprite::play(const std::string &action)
bool CompoundSprite::update(const int time)
{
bool ret = false;
-
FOR_EACH (SpriteIterator, it, mSprites)
{
if (*it)
ret |= (*it)->update(time);
}
-
mNeedsRedraw |= ret;
return ret;
}
@@ -132,9 +123,8 @@ bool CompoundSprite::draw(Graphics *const graphics,
else if (mAlpha && mAlphaImage)
{
mAlphaImage->setAlpha(mAlpha);
-
return graphics->drawImage(mAlphaImage,
- posX + mOffsetX, posY + mOffsetY);
+ posX + mOffsetX, posY + mOffsetY);
}
else
{
@@ -206,13 +196,11 @@ const Image *CompoundSprite::getImage() const
bool CompoundSprite::setSpriteDirection(const SpriteDirection direction)
{
bool ret = false;
-
FOR_EACH (SpriteIterator, it, mSprites)
{
if (*it)
ret |= (*it)->setSpriteDirection(direction);
}
-
mNeedsRedraw |= ret;
return ret;
}
@@ -232,7 +220,6 @@ unsigned int CompoundSprite::getCurrentFrame() const
if (*it)
return (*it)->getCurrentFrame();
}
-
return 0;
}
@@ -243,7 +230,6 @@ unsigned int CompoundSprite::getFrameCount() const
if (*it)
return (*it)->getFrameCount();
}
-
return 0;
}
@@ -304,7 +290,7 @@ void CompoundSprite::ensureSize(size_t layerCount)
/**
* Returns the curent frame in the current animation of the given layer.
*/
-unsigned int CompoundSprite::getCurrentFrame(unsigned int layer)
+unsigned int CompoundSprite::getCurrentFrame(unsigned int layer) const
{
if (layer >= mSprites.size())
return 0;