From e6ab5b97957bcfc143876c036af90f7883395ab9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 30 Jun 2013 21:02:32 +0300 Subject: improve size() usage in being. --- src/being.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/being.cpp b/src/being.cpp index 2ce0657fb..393b37d3b 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2295,11 +2295,12 @@ void Being::recalcSpritesOrder() mSpriteHide[slot] = 0; } + const size_t spriteIdSize = mSpriteIDs.size(); for (unsigned slot = 0; slot < sz; slot ++) { slotRemap.push_back(slot); - if (mSpriteIDs.size() <= slot) + if (spriteIdSize <= slot) continue; const int id = mSpriteIDs[slot]; @@ -2452,7 +2453,7 @@ void Being::recalcSpritesOrder() const int val = slotRemap.at(slot); int id = 0; - if (static_cast(mSpriteIDs.size()) > val) + if (static_cast(spriteIdSize) > val) id = mSpriteIDs[val]; int idx = -1; @@ -2529,7 +2530,8 @@ void Being::recalcSpritesOrder() int Being::searchSlotValue(const std::vector &slotRemap, const int val) const { - for (unsigned slot = 0; slot < size(); slot ++) + const size_t sz = size(); + for (size_t slot = 0; slot < sz; slot ++) { if (slotRemap[slot] == val) return slot; -- cgit v1.2.3-70-g09d2