diff options
| author | Spp <none@none> | 2010-12-13 21:28:33 +0100 |
|---|---|---|
| committer | Spp <none@none> | 2010-12-13 21:28:33 +0100 |
| commit | 9815847511b131f8ae550a9594fdab37970a193a (patch) | |
| tree | 21c0f2bd1653667f8dcc16d1b852aa151a99be95 | |
| parent | 620cde80cd74c173138f33c836820085fbf5009b (diff) | |
Core/Dungeon Finder: Return a copy of cached dungeons set (to avoid being cleared later in code)
--HG--
branch : trunk
| -rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.cpp | 14 | ||||
| -rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 30cc7c52751..91926c99349 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -536,7 +536,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, LfgDungeonSet& dungeons, std::string // Expand random dungeons and check restrictions if (rDungeonId) - GetDungeonsByRandom(rDungeonId, dungeons); + dungeons = GetDungeonsByRandom(rDungeonId); LfgLockStatusMap* lockStatusMap = CheckCompatibleDungeons(dungeons, players); if (!dungeons.size()) @@ -1831,8 +1831,7 @@ LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player* plr) players.insert(plrg); } - LfgDungeonSet allDungeons; - GetDungeonsByRandom(0, allDungeons); + LfgDungeonSet allDungeons = GetDungeonsByRandom(0); return GetGroupLockStatusDungeons(players, allDungeons, true); } @@ -1844,8 +1843,7 @@ LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player* plr) */ LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player* plr) { - LfgDungeonSet allDungeons; - GetDungeonsByRandom(0, allDungeons); + LfgDungeonSet allDungeons = GetDungeonsByRandom(0); return GetPlayerLockStatusDungeons(plr, allDungeons, true); } @@ -1950,13 +1948,13 @@ LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player* plr, LfgDungeonSet Get the dungeon list that can be done given a random dungeon entry. @param[in] randomdungeon Random dungeon id (if value = 0 will return all dungeons) - @param[out] dungeons Set of dungeons that can be done. + @returns Set of dungeons that can be done. */ -void LFGMgr::GetDungeonsByRandom(uint32 randomdungeon, LfgDungeonSet& dungeons) +LfgDungeonSet LFGMgr::GetDungeonsByRandom(uint32 randomdungeon) { LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(randomdungeon); uint8 groupType = dungeon ? dungeon->grouptype : 0; - dungeons = m_CachedDungeonMap[groupType]; + return m_CachedDungeonMap[groupType]; // Return a copy } /** diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index ddfbfc5235b..75b5f0bee23 100755 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -313,7 +313,7 @@ class LFGMgr LfgLockStatusSet* GetPlayerLockStatusDungeons(Player* plr, LfgDungeonSet& dungeons, bool useEntry); // Generic - void GetDungeonsByRandom(uint32 randomdungeon, LfgDungeonSet& dungeons); + LfgDungeonSet GetDungeonsByRandom(uint32 randomdungeon); LfgType GetDungeonType(uint32 dungeon); std::string ConcatenateGuids(LfgGuidList check); |
