diff options
| author | jackpoz <giacomopoz@gmail.com> | 2015-03-09 21:30:36 +0100 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2015-03-10 21:11:54 +0100 |
| commit | 22403121fe9c762c82dc32913aeba46a7e76a004 (patch) | |
| tree | 66057d3b5a295a2e052f472d0491a6623b527bad /src/server/game/DungeonFinding/LFGMgr.cpp | |
| parent | 147a959f51ca68d28d7ad298af9982ccc8d90101 (diff) | |
Core/Dungeon Finder: Fix Vote Kick breaking LFG queue
Fix Vote Kick started with party in queue breaking the whole LFG queue. The status of Vote Kick is now storing in a bool variable in LfgGroupData, separated from LfgState of the group/members.
If a Vote Kick started with party in queue, the members were not removed from queue correctly and would cause LFG matching system to match these "broken" players but not allowing to start a dungeon.
Closes #10191
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
| -rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 9b3ccc05280..93ebeca9780 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -311,9 +311,8 @@ void LFGMgr::Update(uint32 diff) ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) SendLfgBootProposalUpdate(pguid, boot); - SetState(pguid, LFG_STATE_DUNGEON); } - SetState(itBoot->first, LFG_STATE_DUNGEON); + SetVoteKick(itBoot->first, false); BootsStore.erase(itBoot); } } @@ -643,7 +642,6 @@ void LFGMgr::LeaveLfg(ObjectGuid guid) break; case LFG_STATE_DUNGEON: case LFG_STATE_FINISHED_DUNGEON: - case LFG_STATE_BOOT: if (guid != gguid) // Player SetState(guid, LFG_STATE_NONE); break; @@ -1156,7 +1154,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate */ void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason) { - SetState(gguid, LFG_STATE_BOOT); + SetVoteKick(gguid, true); LfgPlayerBoot& boot = BootsStore[gguid]; boot.inProgress = true; @@ -1170,7 +1168,6 @@ void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, st for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr) { ObjectGuid guid = (*itr); - SetState(guid, LFG_STATE_BOOT); boot.votes[guid] = LFG_ANSWER_PENDING; } @@ -1227,13 +1224,10 @@ void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept) { ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) - { - SetState(pguid, LFG_STATE_DUNGEON); SendLfgBootProposalUpdate(pguid, boot); - } } - SetState(gguid, LFG_STATE_DUNGEON); + SetVoteKick(gguid, false); if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player { if (Group* group = sGroupMgr->GetGroupByGUID(gguid.GetCounter())) @@ -1495,12 +1489,12 @@ LfgState LFGMgr::GetState(ObjectGuid guid) if (guid.IsGroup()) { state = GroupsStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.group.state.get", "Group: %s, State: %u", guid.ToString().c_str(), state); + TC_LOG_TRACE("lfg.data.group.state.get", "Group: %s, State: %s", guid.ToString().c_str(), GetStateString(state).c_str()); } else { state = PlayersStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.player.state.get", "Player: %s, State: %u", guid.ToString().c_str(), state); + TC_LOG_TRACE("lfg.data.player.state.get", "Player: %s, State: %s", guid.ToString().c_str(), GetStateString(state).c_str()); } return state; @@ -1523,6 +1517,16 @@ LfgState LFGMgr::GetOldState(ObjectGuid guid) return state; } +bool LFGMgr::IsVoteKickActive(ObjectGuid gguid) +{ + ASSERT(gguid.IsGroup()); + + bool active = GroupsStore[gguid].IsVoteKickActive(); + TC_LOG_TRACE("lfg.data.group.votekick.get", "Group: %s, Active: %d", gguid.ToString().c_str(), active); + + return active; +} + uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */) { uint32 dungeon = GroupsStore[guid].GetDungeon(asId); @@ -1683,6 +1687,17 @@ void LFGMgr::SetState(ObjectGuid guid, LfgState state) } } +void LFGMgr::SetVoteKick(ObjectGuid gguid, bool active) +{ + ASSERT(gguid.IsGroup()); + + LfgGroupData& data = GroupsStore[gguid]; + TC_LOG_TRACE("lfg.data.group.votekick.set", "Group: %s, New state: %d, Previous: %d", + gguid.ToString().c_str(), active, data.IsVoteKickActive()); + + data.SetVoteKick(active); +} + void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon) { TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %s, Dungeon: %u", guid.ToString().c_str(), dungeon); |
