diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-01-19 15:25:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-01-20 17:05:57 +0300 |
commit | 48071e171de41a23197c7328ba038331a936e0eb (patch) | |
tree | 73c7ef1da8e5dd76469d75c0336d88c3371e4263 /src/playerrelations.cpp | |
parent | d07fba228b5251862ad670e1d4f079c9456fab4b (diff) | |
download | plus-48071e171de41a23197c7328ba038331a936e0eb.tar.gz plus-48071e171de41a23197c7328ba038331a936e0eb.tar.bz2 plus-48071e171de41a23197c7328ba038331a936e0eb.tar.xz plus-48071e171de41a23197c7328ba038331a936e0eb.zip |
Replace for to FOR_EACH in some classes.
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r-- | src/playerrelations.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index fee43107e..7d7716c3e 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -137,21 +137,16 @@ PlayerRelationsManager::~PlayerRelationsManager() { delete_all(mIgnoreStrategies); - for (PlayerRelationsCIter it = mRelations.begin(), - it_end = mRelations.end(); it != it_end; ++ it) - { + FOR_EACH (PlayerRelationsCIter, it, mRelations) delete it->second; - } + mRelations.clear(); } void PlayerRelationsManager::clear() { StringVect *names = getPlayers(); - for (StringVectCIter it = names->begin(), it_end = names->end(); - it != it_end; ++ it) - { + FOR_EACHP (StringVectCIter, it, names) removePlayer(*it); - } delete names; } @@ -217,11 +212,8 @@ void PlayerRelationsManager::init() // until the next update. } - for (PlayerRelationListenersCIter it = mListeners.begin(), - it_end = mListeners.end(); it != it_end; ++it) - { + FOR_EACH (PlayerRelationListenersCIter, it, mListeners) (*it)->updateAll(); - } } void PlayerRelationsManager::store() @@ -245,11 +237,8 @@ void PlayerRelationsManager::store() void PlayerRelationsManager::signalUpdate(const std::string &name) { - for (PlayerRelationListenersCIter it = mListeners.begin(), - it_end = mListeners.end(); it != it_end; ++ it) - { + FOR_EACH (PlayerRelationListenersCIter, it, mListeners) (*it)->updatedPlayer(name); - } if (actorSpriteManager) { @@ -357,8 +346,7 @@ StringVect * PlayerRelationsManager::getPlayers() { StringVect *const retval = new StringVect(); - for (PlayerRelationsCIter it = mRelations.begin(), - it_end = mRelations.end(); it != it_end; ++ it) + FOR_EACH (PlayerRelationsCIter, it, mRelations) { if (it->second) retval->push_back(it->first); @@ -374,8 +362,7 @@ StringVect *PlayerRelationsManager::getPlayersByRelation( { StringVect *const retval = new StringVect(); - for (PlayerRelationsCIter it = mRelations.begin(), - it_end = mRelations.end(); it != it_end; ++ it) + FOR_EACH (PlayerRelationsCIter, it, mRelations) { if (it->second && it->second->mRelation == rel) retval->push_back(it->first); |