diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-09-12 21:50:10 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2020-09-12 21:50:10 +0200 |
commit | f0f0de01fad0bc7bdfda215ec1a0f5b58d4a0ebf (patch) | |
tree | 3c333aff0eadf77b4505f6e2e4c509a7f23d41a4 | |
parent | 29b39ae6063f69e185b26712079c5b77000027b5 (diff) |
Core/LFG: Handle vote kick as failed if there cannot be 3 votes agreeing
i.e: 4 players, vote kick starts, 1 rejects, vote is considered as failed.
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index ef4d316387e..38cb9ae38f2 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1276,20 +1276,25 @@ void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept) boot.votes[guid] = LfgAnswer(accept); - uint8 votesNum = 0; uint8 agreeNum = 0; + uint8 denyNum = 0; for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes) { - if (itVotes->second != LFG_ANSWER_PENDING) + switch (itVotes->second) { - ++votesNum; - if (itVotes->second == LFG_ANSWER_AGREE) + case LFG_ANSWER_PENDING: + break; + case LFG_ANSWER_AGREE: ++agreeNum; + break; + case LFG_ANSWER_DENY: + ++denyNum; + break; } } // if we don't have enough votes (agree or deny) do nothing - if (agreeNum < LFG_GROUP_KICK_VOTES_NEEDED && (votesNum - agreeNum) < LFG_GROUP_KICK_VOTES_NEEDED) + if (agreeNum < LFG_GROUP_KICK_VOTES_NEEDED && (boot.votes.size() - denyNum) >= LFG_GROUP_KICK_VOTES_NEEDED) return; // Send update info to all players |