diff options
author | Spp <none@none> | 2010-11-26 04:44:57 +0100 |
---|---|---|
committer | Spp <none@none> | 2010-11-26 04:44:57 +0100 |
commit | 4ace88e909964468cc80fc45943c6c6f48faec43 (patch) | |
tree | a79d40d1199d040a711a486bc19068093f517c59 /src | |
parent | bbe955c5abe33735b3199c6d414a74f4355a2e94 (diff) |
Core/Dungeon Finder: Properly remove players from queue (or readd) after a proposal failed
--HG--
branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.cpp | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index c488e864312..8cb3909de82 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1658,49 +1658,53 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t if (it->second->accept != LFG_ANSWER_AGREE) it->second->accept = LFG_ANSWER_DENY; + // Remove from queue all players/groups that didn't accept + for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it) + if (it->second->accept == LFG_ANSWER_DENY) + RemoveFromQueue(it->second->groupLowGuid ? MAKE_NEW_GUID(it->second->groupLowGuid, 0, HIGHGUID_GROUP) : MAKE_NEW_GUID(it->first, 0, HIGHGUID_PLAYER)); + // Inform players for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it) { plr = sObjectMgr.GetPlayerByLowGUID(it->first); if (!plr) continue; + plr->GetSession()->SendUpdateProposal(itProposal->first, pProposal); guid = it->second->groupLowGuid ? MAKE_NEW_GUID(it->second->groupLowGuid, 0, HIGHGUID_GROUP) : plr->GetGUID(); - plr->GetSession()->SendUpdateProposal(itProposal->first, pProposal); - // Remove members that didn't accept - if (it->second->accept == LFG_ANSWER_DENY) + itQueue = m_QueueInfoMap.find(guid); + if (itQueue == m_QueueInfoMap.end()) // Didn't accept or in same group that someone that didn't accept { - updateType = type; + if (it->second->accept == LFG_ANSWER_DENY) + { + updateType = type; + sLog.outDebug("LFGMgr::RemoveProposal: [" UI64FMTD "] didn't accept. Removing from queue and compatible cache", guid); + } + else + { + updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE; + sLog.outDebug("LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid); + } plr->GetLfgDungeons()->clear(); plr->SetLfgRoles(ROLE_NONE); if (!plr->GetGroup() || !plr->GetGroup()->isLFGGroup()) plr->SetLfgState(LFG_STATE_NONE); - sLog.outDebug("LFGMgr::RemoveProposal: [" UI64FMTD "] didn't accept. Removing from queue and compatible cache", guid); - RemoveFromQueue(guid); + if (plr->GetGroup()) + plr->GetSession()->SendLfgUpdateParty(updateType); + else + plr->GetSession()->SendLfgUpdatePlayer(updateType); } - else // Readd to queue + else { - itQueue = m_QueueInfoMap.find(guid); - if (itQueue == m_QueueInfoMap.end()) // Can't readd! misssing queue info! - { - sLog.outError("LFGMgr::RemoveProposal: Imposible to readd [" UI64FMTD "] to queue. Missing queue info!", guid); - updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE; - } + sLog.outDebug("LFGMgr::RemoveProposal: Readding [" UI64FMTD "] to queue.", guid); + itQueue->second->joinTime = time_t(time(NULL)); + AddGuidToNewQueue(guid); + if (plr->GetGroup()) + plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_ADDED_TO_QUEUE, plr->GetLfgDungeons(), plr->GetLfgComment()); else - { - sLog.outDebug("LFGMgr::RemoveProposal: Readding [" UI64FMTD "] to queue.", guid); - itQueue->second->joinTime = time_t(time(NULL)); - AddGuidToNewQueue(guid); - updateType = LFG_UPDATETYPE_ADDED_TO_QUEUE; - } + plr->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_ADDED_TO_QUEUE, plr->GetLfgDungeons(), plr->GetLfgComment()); } - - if (plr->GetGroup()) - plr->GetSession()->SendLfgUpdateParty(updateType, plr->GetLfgDungeons(), plr->GetLfgComment()); - else - plr->GetSession()->SendLfgUpdatePlayer(updateType, plr->GetLfgDungeons(), plr->GetLfgComment()); - } for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it) |