Core/Dungeon Finder: Return a copy of cached dungeons set (to avoid being cleared later in code)

--HG--
branch : trunk
This commit is contained in:
Spp
2010-12-13 21:28:33 +01:00
parent 620cde80cd
commit 9815847511
2 changed files with 7 additions and 9 deletions
+6 -8
View File
@@ -536,7 +536,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, LfgDungeonSet& dungeons, std::string
// Expand random dungeons and check restrictions // Expand random dungeons and check restrictions
if (rDungeonId) if (rDungeonId)
GetDungeonsByRandom(rDungeonId, dungeons); dungeons = GetDungeonsByRandom(rDungeonId);
LfgLockStatusMap* lockStatusMap = CheckCompatibleDungeons(dungeons, players); LfgLockStatusMap* lockStatusMap = CheckCompatibleDungeons(dungeons, players);
if (!dungeons.size()) if (!dungeons.size())
@@ -1831,8 +1831,7 @@ LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player* plr)
players.insert(plrg); players.insert(plrg);
} }
LfgDungeonSet allDungeons; LfgDungeonSet allDungeons = GetDungeonsByRandom(0);
GetDungeonsByRandom(0, allDungeons);
return GetGroupLockStatusDungeons(players, allDungeons, true); return GetGroupLockStatusDungeons(players, allDungeons, true);
} }
@@ -1844,8 +1843,7 @@ LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player* plr)
*/ */
LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player* plr) LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player* plr)
{ {
LfgDungeonSet allDungeons; LfgDungeonSet allDungeons = GetDungeonsByRandom(0);
GetDungeonsByRandom(0, allDungeons);
return GetPlayerLockStatusDungeons(plr, allDungeons, true); 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. 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[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); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(randomdungeon);
uint8 groupType = dungeon ? dungeon->grouptype : 0; uint8 groupType = dungeon ? dungeon->grouptype : 0;
dungeons = m_CachedDungeonMap[groupType]; return m_CachedDungeonMap[groupType]; // Return a copy
} }
/** /**
+1 -1
View File
@@ -313,7 +313,7 @@ class LFGMgr
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player* plr, LfgDungeonSet& dungeons, bool useEntry); LfgLockStatusSet* GetPlayerLockStatusDungeons(Player* plr, LfgDungeonSet& dungeons, bool useEntry);
// Generic // Generic
void GetDungeonsByRandom(uint32 randomdungeon, LfgDungeonSet& dungeons); LfgDungeonSet GetDungeonsByRandom(uint32 randomdungeon);
LfgType GetDungeonType(uint32 dungeon); LfgType GetDungeonType(uint32 dungeon);
std::string ConcatenateGuids(LfgGuidList check); std::string ConcatenateGuids(LfgGuidList check);