diff options
author | jackpoz <giacomopoz@gmail.com> | 2020-09-12 21:50:10 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-06 00:05:38 +0100 |
commit | d1bea3e8b39c53b5427bfef9806e0282624e891f (patch) | |
tree | 8152bc6f803aab7696392c7295045eb12333bf69 /src/server/game/DungeonFinding/LFGMgr.cpp | |
parent | 2b515f97a681cddb86dadc86f920952bf67abd96 (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.
(cherry picked from commit f0f0de01fad0bc7bdfda215ec1a0f5b58d4a0ebf)
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
-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 eac62425c51..f87b15bee74 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1298,20 +1298,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 |