diff options
author | Spp <none@none> | 2010-09-30 13:52:29 +0200 |
---|---|---|
committer | Spp <none@none> | 2010-09-30 13:52:29 +0200 |
commit | b6ebbd744c169e7aecbfd917dec5c44516bc53a5 (patch) | |
tree | ab243b4a2730a087d60c14da02288bf6573ec2ef /src | |
parent | 62b853e8edc5d8e8a7ae37a08b5c5b5a836e7d63 (diff) |
Core/Dungeon Finder: Fix some errors in Join
- return Internal error if group/player already in queue (They shouldn't be able to join when already queued)
- Fix crash when trying to delete player selected dungeons (cause was forcing a leave in join to keep consistency) and return a proper lfg error
- Fixes issue 4262
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 79bd537e5b5..ec601717437 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -561,6 +561,7 @@ bool LFGMgr::RemoveFromQueue(uint64 guid) /// <param name="Player*">Player</param> void LFGMgr::Join(Player* plr) { + LfgDungeonSet* dungeons = NULL; Group* grp = plr->GetGroup(); if (grp && grp->GetLeaderGUID() != plr->GetGUID()) @@ -573,8 +574,12 @@ void LFGMgr::Join(Player* plr) LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid); if (itQueue != m_QueueInfoMap.end()) { - sLog.outError("LFGMgr::Join: [" UI64FMTD "] trying to join but is already in queue! Forcing leave before readding", guid); + time_t now = time_t(time(NULL)); + time_t joinTime = itQueue->second->joinTime; + uint32 diff = uint32(now - joinTime); + sLog.outError("LFGMgr::Join: [" UI64FMTD "] trying to join but is already in queue! diff %u (" UI64FMTD " - " UI64FMTD ")", guid, diff, uint64(now), uint64(joinTime)); Leave(plr, grp); + result = LFG_JOIN_INTERNAL_ERROR; } else if (plr->InBattleground() || plr->InArena() || plr->InBattlegroundQueue()) result = LFG_JOIN_USING_BG_SYSTEM; @@ -584,15 +589,18 @@ void LFGMgr::Join(Player* plr) result = LFG_JOIN_RANDOM_COOLDOWN; else { - // Check if all dungeons are valid - for (LfgDungeonSet::const_iterator it = plr->GetLfgDungeons()->begin(); it != plr->GetLfgDungeons()->end(); ++it) - { - if (!GetDungeonGroupType(*it)) + dungeons = plr->GetLfgDungeons(); + if (!dungeons || dungeons->size()) + result = LFG_JOIN_NOT_MEET_REQS; + else // Check if all dungeons are valid + for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it) { - result = LFG_JOIN_DUNGEON_INVALID; - break; + if (!GetDungeonGroupType(*it)) + { + result = LFG_JOIN_DUNGEON_INVALID; + break; + } } - } } // Group checks @@ -633,7 +641,6 @@ void LFGMgr::Join(Player* plr) return; } - LfgDungeonSet* dungeons = NULL; if (grp) { Player* plrg = NULL; @@ -666,19 +673,17 @@ void LFGMgr::Join(Player* plr) players.insert(plr); dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin()); playersLockMap = CheckCompatibleDungeons(dungeons, &players); + if (dungeons && !dungeons->size()) + { + delete dungeons; + dungeons = NULL; + } } else dungeons = plr->GetLfgDungeons(); if (!dungeons || !dungeons->size()) - { - if (dungeons) - { - delete dungeons; - dungeons = NULL; - } plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0, playersLockMap); - } else { plr->GetSession()->SendLfgJoinResult(LFG_JOIN_OK, 0); |