summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-05 17:15:54 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-05 17:15:54 +0300
commit70a2f900b22258278fde443ec2e3416c56d4f5b5 (patch)
tree0d53fd7a8df884dc3930ab2cd59f88b49f1599fe
parent7ec8cec84e27c3460c6d51b3c58e0644de247102 (diff)
downloadmanaplus-70a2f900b22258278fde443ec2e3416c56d4f5b5.tar.gz
manaplus-70a2f900b22258278fde443ec2e3416c56d4f5b5.tar.bz2
manaplus-70a2f900b22258278fde443ec2e3416c56d4f5b5.tar.xz
manaplus-70a2f900b22258278fde443ec2e3416c56d4f5b5.zip
Sort players in setup relation tab with case insensitive.
-rw-r--r--src/playerrelations.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 5b25ae5fb..8af37aa7d 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -43,6 +43,21 @@
#define IGNORE_EMOTE_TIME 100
+class SortPlayersFunctor
+{
+ public:
+ bool operator() (const std::string &str1, const std::string &str2)
+ {
+ std::string s1 = str1;
+ std::string s2 = str2;
+ toLower(s1);
+ toLower(s2);
+ if (s1 == s2)
+ return str1 < str2;
+ return s1 < s2;
+ }
+} playersSorter;
+
// (De)serialisation class
class PlayerConfSerialiser :
public ConfigurationListManager<std::pair<std::string, PlayerRelation *>,
@@ -327,7 +342,7 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers()
retval->push_back(it->first);
}
- sort(retval->begin(), retval->end());
+ sort(retval->begin(), retval->end(), playersSorter);
return retval;
}