aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpp <none@none>2010-08-18 22:50:04 +0200
committerSpp <none@none>2010-08-18 22:50:04 +0200
commitfb9c6c96c73a12f261cfde3743337e83692ea426 (patch)
treebba8dc4b401a7edf3a4f30ecab2af9f5b5e14308
parenteebb36ba5801535b2c5705ade019812b63cfd0d7 (diff)
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
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 01c8d6fe8fe..3c707d275cc 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -632,12 +632,15 @@ bool LFGMgr::RemoveFromQueue(uint64 guid)
/// <param name="LfgProposalList *">Proposals found.</param>
void LFGMgr::FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals)
{
+ if (!check.size() || check.size() > MAXGROUPSIZE)
+ return;
+
uint8 numPlayers = 0;
uint8 numLfgGroups = 0;
uint32 groupLowGuid = 0;
LfgQueueInfoMap pqInfoMap;
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);
if (itQueue == m_QueueInfoMap.end())
@@ -670,7 +673,7 @@ void LFGMgr::FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList
if (numPlayers < MAXGROUPSIZE)
{
- while (!all.empty() && check.size() < MAXGROUPSIZE)
+ while (!all.empty() && !proposals->size())
{
check.push_back(all.front());
all.pop_front();