diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:21:43 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-29 14:18:06 +0100 |
commit | e7c285e3423ddd660447f6a6fc6bbae25f99f386 (patch) | |
tree | 1d700f09a5e96a2a0d390af30581097bdec0bf77 /src/playerrelations.cpp | |
parent | e1a7c1d0ca30c2c4a293ffbff6b9c51c881d23e3 (diff) | |
download | mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.gz mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.bz2 mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.xz mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.zip |
Apply C++11 fixits
modernize-loop-convert
modernize-deprecated-headers
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r-- | src/playerrelations.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index f65b1fc7..39a2447a 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -108,10 +108,9 @@ PlayerRelationsManager::~PlayerRelationsManager() void PlayerRelationsManager::clear() { std::vector<std::string> *names = getPlayers(); - for (std::vector<std::string>::const_iterator - it = names->begin(); it != names->end(); it++) + for (const auto &name : *names) { - removePlayer(*it); + removePlayer(name); } delete names; } @@ -261,13 +260,13 @@ void PlayerRelationsManager::setRelation(const std::string &playerName, signalUpdate(playerName); } -std::vector<std::string> * PlayerRelationsManager::getPlayers() const +std::vector<std::string> *PlayerRelationsManager::getPlayers() const { auto *retval = new std::vector<std::string>(); - for (auto it = mRelations.begin(); it != mRelations.end(); it++) - if (it->second) - retval->push_back(it->first); + for (const auto &relation : mRelations) + if (relation.second) + retval->push_back(relation.first); sort(retval->begin(), retval->end()); @@ -276,8 +275,7 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers() const void PlayerRelationsManager::removePlayer(const std::string &name) { - auto it = - mRelations.find(name); + auto it = mRelations.find(name); if (it != mRelations.end()) { delete it->second; |