Dungeon Finder: Some optimizations to find algorithm
* Select first match as valid (Before it was storing all possible and later selecting one) * Add some checks to make sure no unnecessary calcs are done --HG-- branch : trunk
This commit is contained in:
@@ -632,12 +632,15 @@ bool LFGMgr::RemoveFromQueue(uint64 guid)
|
|||||||
/// <param name="LfgProposalList *">Proposals found.</param>
|
/// <param name="LfgProposalList *">Proposals found.</param>
|
||||||
void LFGMgr::FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals)
|
void LFGMgr::FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals)
|
||||||
{
|
{
|
||||||
|
if (!check.size() || check.size() > MAXGROUPSIZE)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8 numPlayers = 0;
|
uint8 numPlayers = 0;
|
||||||
uint8 numLfgGroups = 0;
|
uint8 numLfgGroups = 0;
|
||||||
uint32 groupLowGuid = 0;
|
uint32 groupLowGuid = 0;
|
||||||
LfgQueueInfoMap pqInfoMap;
|
LfgQueueInfoMap pqInfoMap;
|
||||||
LfgQueueInfoMap::iterator itQueue;
|
LfgQueueInfoMap::iterator itQueue;
|
||||||
for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
|
for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
|
||||||
{
|
{
|
||||||
itQueue = m_QueueInfoMap.find(*it);
|
itQueue = m_QueueInfoMap.find(*it);
|
||||||
if (itQueue == m_QueueInfoMap.end())
|
if (itQueue == m_QueueInfoMap.end())
|
||||||
@@ -670,7 +673,7 @@ void LFGMgr::FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList
|
|||||||
|
|
||||||
if (numPlayers < MAXGROUPSIZE)
|
if (numPlayers < MAXGROUPSIZE)
|
||||||
{
|
{
|
||||||
while (!all.empty() && check.size() < MAXGROUPSIZE)
|
while (!all.empty() && !proposals->size())
|
||||||
{
|
{
|
||||||
check.push_back(all.front());
|
check.push_back(all.front());
|
||||||
all.pop_front();
|
all.pop_front();
|
||||||
|
|||||||
Reference in New Issue
Block a user