From 72277b0c8a16a5a2aabd634b127bcadd698430d5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 17 Jan 2012 02:32:13 +0300 Subject: Add friends tab to social window. --- src/playerrelations.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/playerrelations.cpp') 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 * PlayerRelationsManager::getPlayers() return retval; } +std::vector *PlayerRelationsManager::getPlayersByRelation( + PlayerRelation::Relation rel) +{ + std::vector *retval = new std::vector(); + + for (std::map::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]) -- cgit v1.2.3-70-g09d2