From 48071e171de41a23197c7328ba038331a936e0eb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 19 Jan 2013 15:25:24 +0300 Subject: Replace for to FOR_EACH in some classes. --- src/being.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index 910feb936..633be5d53 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -190,7 +190,8 @@ bool Being::mEnableReorderSprites = true; bool Being::mHideErased = false; std::list beingInfoCache; - +typedef std::map::const_iterator GuildsMapCIter; +typedef std::map::const_iterator IntMapCIter; // TODO: mWalkTime used by eAthena only Being::Being(const int id, const Type type, const uint16_t subtype, @@ -908,8 +909,7 @@ void Being::removeGuild(const int id) Guild *Being::getGuild(const std::string &guildName) const { - for (std::map::const_iterator itr = mGuilds.begin(), - itr_end = mGuilds.end(); itr != itr_end; ++itr) + FOR_EACH (GuildsMapCIter, itr, mGuilds) { Guild *const guild = itr->second; if (guild && guild->getName() == guildName) @@ -939,8 +939,7 @@ Guild *Being::getGuild() const void Being::clearGuilds() { - for (std::map::const_iterator itr = mGuilds.begin(), - itr_end = mGuilds.end(); itr != itr_end; ++itr) + FOR_EACH (GuildsMapCIter, itr, mGuilds) { Guild *const guild = itr->second; @@ -2034,8 +2033,7 @@ void Being::addToCache() const BeingCacheEntry* Being::getCacheEntry(const int id) { - for (std::list::iterator i = beingInfoCache.begin(); - i != beingInfoCache.end(); ++ i) + FOR_EACH (std::list::iterator, i, beingInfoCache) { if (!*i) continue; @@ -2346,8 +2344,7 @@ void Being::recalcSpritesOrder() if (spriteToItems) { - for (SpriteToItemMapCIter itr = spriteToItems->begin(), - itr_end = spriteToItems->end(); itr != itr_end; ++ itr) + FOR_EACHP (SpriteToItemMapCIter, itr, spriteToItems) { const int remSprite = itr->first; const std::map &itemReplacer = itr->second; @@ -2392,10 +2389,7 @@ void Being::recalcSpritesOrder() } else { // slot unknown. Search for real slot, this can be slow - for (std::map::const_iterator - repIt = itemReplacer.begin(), - repIt_end = itemReplacer.end(); - repIt != repIt_end; ++ repIt) + FOR_EACH (IntMapCIter, repIt, itemReplacer) { for (unsigned slot2 = 0; slot2 < sz; slot2 ++) { -- cgit v1.2.3-60-g2f50