summaryrefslogtreecommitdiff
path: root/src/party.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-03-26 23:15:47 +0300
committerAndrei Karas <akaras@inbox.ru>2018-03-26 23:15:47 +0300
commit384170a93ed0ef61e7cab20f19ee91f2dad5f6f7 (patch)
tree343ff47015524ccc701cf5b9e3e879f1891a1fda /src/party.cpp
parent6b0ecb7f33231e79277f36faf6a8e0e94339efca (diff)
downloadplus-384170a93ed0ef61e7cab20f19ee91f2dad5f6f7.tar.gz
plus-384170a93ed0ef61e7cab20f19ee91f2dad5f6f7.tar.bz2
plus-384170a93ed0ef61e7cab20f19ee91f2dad5f6f7.tar.xz
plus-384170a93ed0ef61e7cab20f19ee91f2dad5f6f7.zip
Fix possible sorting issues in party.
Diffstat (limited to 'src/party.cpp')
-rw-r--r--src/party.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/party.cpp b/src/party.cpp
index 63c8e62ad..af4a27780 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -37,13 +37,12 @@ static class SortPartyFunctor final
bool operator() (const PartyMember *const p1,
const PartyMember *const p2) const
{
- if ((p1 == nullptr) || (p2 == nullptr))
+ if (p1 == nullptr || p2 == nullptr)
return false;
- if (p1->getLeader())
- return true;
- if (p2->getLeader())
- return false;
-
+ const int leader1 = CAST_S32(p1->getLeader());
+ const int leader2 = CAST_S32(p2->getLeader());
+ if (leader1 != leader2)
+ return leader1 >= leader2;
if (p1->getName() != p2->getName())
{
std::string s1 = p1->getName();