summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-04 21:24:29 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-04 21:39:07 +0300
commit2521a791d764920c194e8fe299110e98dc2e5ab3 (patch)
tree9894d9cabae064e3ab8ab0d43864c152079a750d /src
parent9706e377c799d4b2c0a9f88c8ba6768bf2ea858c (diff)
downloadmv-2521a791d764920c194e8fe299110e98dc2e5ab3.tar.gz
mv-2521a791d764920c194e8fe299110e98dc2e5ab3.tar.bz2
mv-2521a791d764920c194e8fe299110e98dc2e5ab3.tar.xz
mv-2521a791d764920c194e8fe299110e98dc2e5ab3.zip
Remove getter getSprite from compoundsprite.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp4
-rw-r--r--src/being/compoundsprite.cpp7
-rw-r--r--src/being/compoundsprite.h6
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp4
5 files changed, 11 insertions, 12 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 0d894c6ff..b3a6fbeaa 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2899,7 +2899,7 @@ void Being::drawSprites(Graphics *restrict const graphics,
if (rSprite == 1)
continue;
- Sprite *restrict const sprite = getSprite(mSpriteRemap[f]);
+ Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
if (sprite)
{
sprite->setAlpha(mAlpha);
@@ -2919,7 +2919,7 @@ void Being::drawSpritesSDL(Graphics *restrict const graphics,
if (rSprite == 1)
continue;
- const Sprite *restrict const sprite = getSprite(mSpriteRemap[f]);
+ const Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
if (sprite)
sprite->draw(graphics, posX, posY);
}
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index 981125633..220cadea8 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -60,6 +60,8 @@ static const unsigned cache_clean_part = 3;
bool CompoundSprite::mEnableDelay = true;
CompoundSprite::CompoundSprite() :
+ Sprite(),
+ mSprites(),
imagesCache(),
mCacheItem(nullptr),
mImage(nullptr),
@@ -68,7 +70,6 @@ CompoundSprite::CompoundSprite() :
mOffsetY(0),
mStartTime(0),
mLastTime(0),
- mSprites(),
#ifndef USE_SDL2
mNextRedrawTime(0),
#endif
@@ -317,7 +318,7 @@ unsigned int CompoundSprite::getCurrentFrame(unsigned int layer) const
if (layer >= CAST_U32(mSprites.size()))
return 0;
- const Sprite *const s = getSprite(layer);
+ const Sprite *const s = mSprites[layer];
if (s)
return s->getCurrentFrame();
@@ -332,7 +333,7 @@ unsigned int CompoundSprite::getFrameCount(unsigned int layer)
if (layer >= CAST_U32(mSprites.size()))
return 0;
- const Sprite *const s = getSprite(layer);
+ const Sprite *const s = mSprites[layer];
if (s)
return s->getFrameCount();
diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h
index 797ae767c..2966eec44 100644
--- a/src/being/compoundsprite.h
+++ b/src/being/compoundsprite.h
@@ -85,9 +85,6 @@ class CompoundSprite notfinal : public Sprite
void setSprite(const size_t layer, Sprite *const sprite);
- Sprite *getSprite(const size_t layer) const A_WARN_UNUSED
- { return mSprites.at(layer); }
-
void removeSprite(const int layer);
void clear();
@@ -127,6 +124,8 @@ class CompoundSprite notfinal : public Sprite
int getStartTime() const A_WARN_UNUSED
{ return mStartTime; }
+ std::vector<Sprite*> mSprites;
+
private:
void redraw() const;
@@ -147,7 +146,6 @@ class CompoundSprite notfinal : public Sprite
mutable int mOffsetY;
int mStartTime;
int mLastTime;
- std::vector<Sprite*> mSprites;
#ifndef USE_SDL2
mutable int mNextRedrawTime;
#endif
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 9336edae7..cc85f9ee8 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2329,7 +2329,7 @@ void LocalPlayer::imitateOutfit(const Being *const player,
const AnimatedSprite *const equipmentSprite
= dynamic_cast<const AnimatedSprite *const>(
- player->getSprite(sprite));
+ player->mSprites[sprite]);
if (equipmentSprite)
{
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 452567b94..7f34d9f6e 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -1161,7 +1161,7 @@ void NpcDialog::showAvatar(const BeingTypeId avatarId)
mPlayerBox->setWidth(width + pad2);
mPlayerBox->setHeight(info->getHeight() + pad2);
}
- const Sprite *const sprite = mAvatarBeing->getSprite(0);
+ const Sprite *const sprite = mAvatarBeing->mSprites[0];
if (sprite && !width)
{
mPlayerBox->setWidth(sprite->getWidth() + pad2);
@@ -1208,7 +1208,7 @@ void NpcDialog::logic()
mAvatarBeing->logic();
if (mPlayerBox->getWidth() < CAST_S32(3 * getPadding()))
{
- const Sprite *const sprite = mAvatarBeing->getSprite(0);
+ const Sprite *const sprite = mAvatarBeing->mSprites[0];
if (sprite)
{
mPlayerBox->setWidth(sprite->getWidth() + 2 * getPadding());