diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-30 21:02:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-30 21:21:17 +0300 |
commit | e6ab5b97957bcfc143876c036af90f7883395ab9 (patch) | |
tree | 9dbd0e0f44a0334095ed3d32dfc0296a6f502a0f | |
parent | 303248d3d82d098fb19a72cf87426104faf4f56a (diff) | |
download | manaverse-e6ab5b97957bcfc143876c036af90f7883395ab9.tar.gz manaverse-e6ab5b97957bcfc143876c036af90f7883395ab9.tar.bz2 manaverse-e6ab5b97957bcfc143876c036af90f7883395ab9.tar.xz manaverse-e6ab5b97957bcfc143876c036af90f7883395ab9.zip |
improve size() usage in being.
-rw-r--r-- | src/being.cpp | 8 |
1 files 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<int>(mSpriteIDs.size()) > val) + if (static_cast<int>(spriteIdSize) > val) id = mSpriteIDs[val]; int idx = -1; @@ -2529,7 +2530,8 @@ void Being::recalcSpritesOrder() int Being::searchSlotValue(const std::vector<int> &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; |