From 1a31d0573e3e714664631ac40686c0d61b4bccc9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Mar 2016 21:39:15 +0300 Subject: Remove getter size from compoundsprite. --- src/being/being.cpp | 10 +++++----- src/being/being.h | 4 ++-- src/being/compoundsprite.cpp | 13 ++++++------- src/being/compoundsprite.h | 3 --- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index b3a6fbeaa..10b4f7acf 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2467,7 +2467,7 @@ void Being::setSprite(const unsigned int slot, if (!charServerHandler || slot >= charServerHandler->maxSprite()) return; - if (slot >= CAST_U32(size())) + if (slot >= CAST_U32(mSprites.size())) ensureSize(slot + 1); if (slot >= CAST_U32(mSpriteIDs.size())) @@ -2912,8 +2912,8 @@ void Being::drawSpritesSDL(Graphics *restrict const graphics, const int posX, const int posY) const restrict2 { - const unsigned int sz = CAST_U32(size()); - for (unsigned int f = 0; f < sz; f ++) + const size_t sz = mSprites.size(); + for (size_t f = 0; f < sz; f ++) { const int rSprite = mSpriteHide[mSpriteRemap[f]]; if (rSprite == 1) @@ -3115,7 +3115,7 @@ void Being::recalcSpritesOrder() restrict2 return; // logger->log("recalcSpritesOrder"); - const size_t sz = size(); + const size_t sz = mSprites.size(); if (sz < 1) return; @@ -3411,7 +3411,7 @@ void Being::recalcSpritesOrder() restrict2 int Being::searchSlotValue(const std::vector &restrict slotRemap, const int val) const restrict2 { - const size_t sz = size(); + const size_t sz = mSprites.size(); for (size_t slot = 0; slot < sz; slot ++) { if (slotRemap[slot] == val) diff --git a/src/being/being.h b/src/being/being.h index 8c518cf26..17286026a 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -303,8 +303,8 @@ class Being notfinal : public ActorSprite, Party *getParty() const restrict2 noexcept A_WARN_UNUSED { return mParty; } - int getSpritesCount() const restrict2 A_WARN_UNUSED - { return CAST_S32(size()); } + size_t getSpritesCount() const restrict2 A_WARN_UNUSED + { return mSprites.size(); } /** * Sets visible equipments for this being. diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp index 220cadea8..0ec252961 100644 --- a/src/being/compoundsprite.cpp +++ b/src/being/compoundsprite.cpp @@ -235,7 +235,7 @@ int CompoundSprite::getNumberOfLayers() const if (mImage || mAlphaImage) return 1; else - return CAST_S32(size()); + return CAST_S32(mSprites.size()); } unsigned int CompoundSprite::getCurrentFrame() const @@ -423,12 +423,11 @@ void CompoundSprite::setAlpha(float alpha) { if (alpha != mAlpha) { + if (mEnableAlphaFix && #ifdef USE_OPENGL - if (mEnableAlphaFix && imageHelper->useOpenGL() == RENDER_SOFTWARE - && size() > 3) -#else - if (mEnableAlphaFix && size() > 3) + imageHelper->useOpenGL() == RENDER_SOFTWARE && #endif + mSprites.size() > 3U) { FOR_EACH (SpriteConstIterator, it, mSprites) { @@ -458,7 +457,7 @@ void CompoundSprite::updateImages() const if (!mDisableBeingCaching) { - if (size() <= 3) + if (mSprites.size() <= 3U) return; if (!mDisableAdvBeingCaching) @@ -503,7 +502,7 @@ bool CompoundSprite::updateFromCache() const // logger->log("cache size: %d, hit %d, miss %d", // (int)imagesCache.size(), hits, miss); - const size_t sz = size(); + const size_t sz = mSprites.size(); FOR_EACH (ImagesCache::iterator, it, imagesCache) { CompoundItem *const ic = *it; diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h index 2966eec44..53a2f189c 100644 --- a/src/being/compoundsprite.h +++ b/src/being/compoundsprite.h @@ -75,9 +75,6 @@ class CompoundSprite notfinal : public Sprite unsigned int getFrameCount() const override final A_WARN_UNUSED; - size_t size() const A_WARN_UNUSED - { return mSprites.size(); } - bool empty() const A_WARN_UNUSED { return mSprites.empty(); } -- cgit v1.2.3-70-g09d2