aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp52
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h2
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp2
3 files changed, 17 insertions, 39 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index f8aea2d10f3..668b1622738 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -809,18 +809,12 @@ void LFGMgr::LeaveLfg(uint64 guid)
RemoveProposal(it, LFG_UPDATETYPE_PROPOSAL_DECLINED);
break;
}
- case LFG_STATE_BOOT:
- if (guid != gguid) // Player
- {
- UpdateBoot(guid); // Forcing LFG_ANSWER_PENDING (Removal of player)
- SetState(guid, LFG_STATE_NONE);
- }
- break;
case LFG_STATE_NONE:
case LFG_STATE_RAIDBROWSER:
break;
case LFG_STATE_DUNGEON:
case LFG_STATE_FINISHED_DUNGEON:
+ case LFG_STATE_BOOT:
if (guid != gguid) // Player
SetState(guid, LFG_STATE_NONE);
break;
@@ -1342,7 +1336,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
@param[in] guid Player who has answered
@param[in] player answer
*/
-void LFGMgr::UpdateBoot(uint64 guid, LfgAnswer answer)
+void LFGMgr::UpdateBoot(uint64 guid, bool accept)
{
uint64 gguid = GetGroup(guid);
if (!gguid)
@@ -1354,42 +1348,26 @@ void LFGMgr::UpdateBoot(uint64 guid, LfgAnswer answer)
LfgPlayerBoot& boot = itBoot->second;
+ if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
+ return;
+
+ boot.votes[guid] = LfgAnswer(accept);
+
uint8 votesNum = 0;
uint8 agreeNum = 0;
-
- if (guid == boot.victim)
- agreeNum = LFG_GROUP_KICK_VOTES_NEEDED + 1; // +1 on purpose to skip kick code
- else if (answer == LFG_ANSWER_PENDING)
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
- boot.votes.erase(guid);
- // If we don't have enough members - force boot fail
- if (boot.votes.size() <= LFG_GROUP_KICK_VOTES_NEEDED)
+ if (itVotes->second != LFG_ANSWER_PENDING)
{
- agreeNum = 0;
- votesNum = boot.votes.size();
+ ++votesNum;
+ if (itVotes->second == LFG_ANSWER_AGREE)
+ ++agreeNum;
}
}
- else
- {
- if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
- return;
-
- boot.votes[guid] = answer;
-
- for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
- {
- if (itVotes->second != LFG_ANSWER_PENDING)
- {
- ++votesNum;
- if (itVotes->second == LFG_ANSWER_AGREE)
- ++agreeNum;
- }
- }
- // 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)
- return;
- }
+ // 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)
+ return;
// Send update info to all players
boot.inProgress = false;
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 158514a080a..14bc0becb02 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -322,7 +322,7 @@ class LFGMgr
// Vote kick
void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
- void UpdateBoot(uint64 guid, LfgAnswer accept = LFG_ANSWER_PENDING);
+ void UpdateBoot(uint64 guid, bool accept);
void InitializeLockedDungeons(Player* player, uint8 level = 0);
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 177815d7454..3f33b60329b 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -146,7 +146,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
uint64 guid = GetPlayer()->GetGUID();
sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE %s agree: %u",
GetPlayerInfo().c_str(), agree ? 1 : 0);
- sLFGMgr->UpdateBoot(guid, agree ? LFG_ANSWER_AGREE : LFG_ANSWER_DENY);
+ sLFGMgr->UpdateBoot(guid, agree);
}
void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData)