summaryrefslogtreecommitdiff
path: root/src/playerrelations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r--src/playerrelations.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 28596ac8b..6b5cb0199 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -361,6 +361,24 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers()
return retval;
}
+std::vector<std::string> *PlayerRelationsManager::getPlayersByRelation(
+ PlayerRelation::Relation rel)
+{
+ std::vector<std::string> *retval = new std::vector<std::string>();
+
+ for (std::map<std::string,
+ PlayerRelation *>::const_iterator it = mRelations.begin();
+ it != mRelations.end(); ++it)
+ {
+ if (it->second && it->second->mRelation == rel)
+ retval->push_back(it->first);
+ }
+
+ sort(retval->begin(), retval->end(), playersSorter);
+
+ return retval;
+}
+
void PlayerRelationsManager::removePlayer(const std::string &name)
{
if (mRelations[name])