Core/Dungeon Finder: Fix crash in Update after DF system gone inconsistent

Note: Reason that makes DF go inconsistent not fixed, as it's not identified

Closes issue 5293

Thanks to cyberbrest for open my eyes and make me spot the problem

--HG--
branch : trunk
This commit is contained in:
Spp
2010-12-28 01:21:05 +01:00
parent 88fe1da9eb
commit 9b73cb1694
+8 -7
View File
@@ -253,13 +253,17 @@ void LFGMgr::Update(uint32 diff)
// Check if a proposal can be formed with the new groups being added // Check if a proposal can be formed with the new groups being added
for (LfgGuidListMap::iterator it = m_newToQueue.begin(); it != m_newToQueue.end(); ++it) for (LfgGuidListMap::iterator it = m_newToQueue.begin(); it != m_newToQueue.end(); ++it)
{ {
uint8 queueId = it->first;
LfgGuidList& newToQueue = it->second; LfgGuidList& newToQueue = it->second;
LfgGuidList& currentQueue = m_currentQueue[it->first]; LfgGuidList& currentQueue = m_currentQueue[queueId];
LfgGuidList firstNew; LfgGuidList firstNew;
while (!newToQueue.empty()) while (!newToQueue.empty())
{ {
sLog->outDebug("LFGMgr::Update: QueueId %u: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", it->first, newToQueue.front(), uint32(newToQueue.size()), uint32(currentQueue.size())); uint64 frontguid = newToQueue.front();
firstNew.push_back(newToQueue.front()); sLog->outDebug("LFGMgr::Update: QueueId %u: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", queueId, frontguid, uint32(newToQueue.size()), uint32(currentQueue.size()));
firstNew.push_back(frontguid);
newToQueue.pop_front();
LfgGuidList temporalList = currentQueue; LfgGuidList temporalList = currentQueue;
if (LfgProposal* pProposal = FindNewGroups(firstNew, temporalList)) // Group found! if (LfgProposal* pProposal = FindNewGroups(firstNew, temporalList)) // Group found!
{ {
@@ -295,10 +299,7 @@ void LFGMgr::Update(uint32 diff)
UpdateProposal(m_lfgProposalId, guid, true); UpdateProposal(m_lfgProposalId, guid, true);
} }
else else
{ currentQueue.push_back(frontguid); // Lfg group not found, add this group to the queue.
currentQueue.push_back(newToQueue.front());// Group not found, add this group to the queue.
newToQueue.pop_front();
}
firstNew.clear(); firstNew.clear();
} }
} }