aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp226
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.h52
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.cpp107
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.h28
-rwxr-xr-xsrc/server/game/Handlers/LFGHandler.cpp8
5 files changed, 214 insertions, 207 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 61c79e62f89..c91be00080e 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -40,7 +40,7 @@ LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1),
LFGMgr::~LFGMgr()
{
- for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr)
+ for (LfgRewardContainer::iterator itr = RewardMapStore.begin(); itr != RewardMapStore.end(); ++itr)
delete itr->second;
}
@@ -181,9 +181,9 @@ void LFGMgr::LoadRewards()
{
uint32 oldMSTime = getMSTime();
- for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr)
+ for (LfgRewardContainer::iterator itr = RewardMapStore.begin(); itr != RewardMapStore.end(); ++itr)
delete itr->second;
- m_RewardMap.clear();
+ RewardMapStore.clear();
// ORDER BY is very important for GetRandomDungeonReward!
QueryResult result = WorldDatabase.Query("SELECT dungeonId, maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar FROM lfg_dungeon_rewards ORDER BY dungeonId, maxLevel ASC");
@@ -233,7 +233,7 @@ void LFGMgr::LoadRewards()
otherQuestId = 0;
}
- m_RewardMap.insert(LfgRewardMap::value_type(dungeonId, new LfgReward(maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar)));
+ RewardMapStore.insert(LfgRewardContainer::value_type(dungeonId, new LfgReward(maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar)));
++count;
} while (result->NextRow());
@@ -242,23 +242,23 @@ void LFGMgr::LoadRewards()
LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id)
{
- LFGDungeonMap::const_iterator itr = m_LfgDungeonMap.find(id);
- if (itr != m_LfgDungeonMap.end())
+ LFGDungeonContainer::const_iterator itr = LfgDungeonStore.find(id);
+ if (itr != LfgDungeonStore.end())
return &(itr->second);
return NULL;
}
-LFGDungeonMap & LFGMgr::GetLFGDungeonMap()
+LFGDungeonContainer & LFGMgr::GetLFGDungeonMap()
{
- return m_LfgDungeonMap;
+ return LfgDungeonStore;
}
void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
{
uint32 oldMSTime = getMSTime();
- m_LfgDungeonMap.clear();
+ LfgDungeonStore.clear();
// Initialize Dungeon map with data from dbcs
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
@@ -273,7 +273,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
case LFG_TYPE_HEROIC:
case LFG_TYPE_RAID:
case LFG_TYPE_RANDOM:
- m_LfgDungeonMap[dungeon->ID] = LFGDungeonData(dungeon);
+ LfgDungeonStore[dungeon->ID] = LFGDungeonData(dungeon);
break;
}
}
@@ -293,8 +293,8 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
{
Field* fields = result->Fetch();
uint32 dungeonId = fields[0].GetUInt32();
- LFGDungeonMap::iterator dungeonItr = m_LfgDungeonMap.find(dungeonId);
- if (dungeonItr == m_LfgDungeonMap.end())
+ LFGDungeonContainer::iterator dungeonItr = LfgDungeonStore.find(dungeonId);
+ if (dungeonItr == LfgDungeonStore.end())
{
sLog->outError(LOG_FILTER_SQL, "table `lfg_entrances` contains coordinates for wrong dungeon %u", dungeonId);
continue;
@@ -313,7 +313,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
// Fill all other teleport coords from areatriggers
- for (LFGDungeonMap::iterator itr = m_LfgDungeonMap.begin(); itr != m_LfgDungeonMap.end(); ++itr)
+ for (LFGDungeonContainer::iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr)
{
LFGDungeonData& dungeon = itr->second;
@@ -335,15 +335,15 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
}
if (dungeon.type != LFG_TYPE_RANDOM)
- m_CachedDungeonMap[dungeon.group].insert(dungeon.id);
- m_CachedDungeonMap[0].insert(dungeon.id);
+ CachedDungeonMapStore[dungeon.group].insert(dungeon.id);
+ CachedDungeonMapStore[0].insert(dungeon.id);
}
if (reload)
{
- m_CachedDungeonMap.clear();
+ CachedDungeonMapStore.clear();
// Recalculate locked dungeons
- for (LfgPlayerDataMap::const_iterator it = m_Players.begin(); it != m_Players.end(); ++it)
+ for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it)
if (Player* player = ObjectAccessor::FindPlayer(it->first))
InitializeLockedDungeons(player);
}
@@ -357,9 +357,9 @@ void LFGMgr::Update(uint32 diff)
time_t currTime = time(NULL);
// Remove obsolete role checks
- for (LfgRoleCheckMap::iterator it = m_RoleChecks.begin(); it != m_RoleChecks.end();)
+ for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();)
{
- LfgRoleCheckMap::iterator itRoleCheck = it++;
+ LfgRoleCheckContainer::iterator itRoleCheck = it++;
LfgRoleCheck& roleCheck = itRoleCheck->second;
if (currTime < roleCheck.cancelTime)
continue;
@@ -373,26 +373,26 @@ void LFGMgr::Update(uint32 diff)
if (guid == roleCheck.leader)
SendLfgJoinResult(guid, LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
}
- m_RoleChecks.erase(itRoleCheck);
+ RoleChecksStore.erase(itRoleCheck);
}
// Remove obsolete proposals
- for (LfgProposalMap::iterator it = m_Proposals.begin(); it != m_Proposals.end();)
+ for (LfgProposalContainer::iterator it = ProposalsStore.begin(); it != ProposalsStore.end();)
{
- LfgProposalMap::iterator itRemove = it++;
+ LfgProposalContainer::iterator itRemove = it++;
if (itRemove->second.cancelTime < currTime)
RemoveProposal(itRemove, LFG_UPDATETYPE_PROPOSAL_FAILED);
}
// Remove obsolete kicks
- for (LfgPlayerBootMap::iterator it = m_Boots.begin(); it != m_Boots.end();)
+ for (LfgPlayerBootContainer::iterator it = BootsStore.begin(); it != BootsStore.end();)
{
- LfgPlayerBootMap::iterator itBoot = it++;
+ LfgPlayerBootContainer::iterator itBoot = it++;
LfgPlayerBoot& boot = itBoot->second;
if (boot.cancelTime < currTime)
{
boot.inProgress = false;
- for (LfgAnswerMap::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
uint64 pguid = itVotes->first;
if (pguid != boot.victim)
@@ -400,26 +400,26 @@ void LFGMgr::Update(uint32 diff)
SetState(pguid, LFG_STATE_DUNGEON);
}
SetState(itBoot->first, LFG_STATE_DUNGEON);
- m_Boots.erase(itBoot);
+ BootsStore.erase(itBoot);
}
}
uint32 lastProposalId = m_lfgProposalId;
// Check if a proposal can be formed with the new groups being added
- for (LfgQueueMap::iterator it = m_Queues.begin(); it != m_Queues.end(); ++it)
+ for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it)
if (uint8 newProposals = it->second.FindGroups())
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Update: Found %u new groups in queue %u", newProposals, it->first);
if (lastProposalId != m_lfgProposalId)
{
// FIXME lastProposalId ? lastProposalId +1 ?
- for (LfgProposalMap::const_iterator itProposal = m_Proposals.find(m_lfgProposalId); itProposal != m_Proposals.end(); ++itProposal)
+ for (LfgProposalContainer::const_iterator itProposal = ProposalsStore.find(m_lfgProposalId); itProposal != ProposalsStore.end(); ++itProposal)
{
uint32 proposalId = itProposal->first;
- LfgProposal& proposal = m_Proposals[proposalId];
+ LfgProposal& proposal = ProposalsStore[proposalId];
uint64 guid = 0;
- for (LfgProposalPlayerMap::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
+ for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
{
guid = itPlayers->first;
SetState(guid, LFG_STATE_PROPOSAL);
@@ -443,7 +443,7 @@ void LFGMgr::Update(uint32 diff)
{
m_QueueTimer = 0;
time_t currTime = time(NULL);
- for (LfgQueueMap::iterator it = m_Queues.begin(); it != m_Queues.end(); ++it)
+ for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it)
it->second.UpdateQueueTimers(currTime);
}
else
@@ -674,7 +674,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
if (grp) // Begin rolecheck
{
// Create new rolecheck
- LfgRoleCheck& roleCheck = m_RoleChecks[gguid];
+ LfgRoleCheck& roleCheck = RoleChecksStore[gguid];
roleCheck.cancelTime = time_t(time(NULL)) + LFG_TIME_ROLECHECK;
roleCheck.state = LFG_ROLECHECK_INITIALITING;
roleCheck.leader = guid;
@@ -784,11 +784,11 @@ void LFGMgr::LeaveLfg(uint64 guid)
case LFG_STATE_PROPOSAL:
{
// Remove from Proposals
- LfgProposalMap::iterator it = m_Proposals.begin();
+ LfgProposalContainer::iterator it = ProposalsStore.begin();
uint64 pguid = gguid == guid ? GetLeader(gguid) : guid;
- while (it != m_Proposals.end())
+ while (it != ProposalsStore.end())
{
- LfgProposalPlayerMap::iterator itPlayer = it->second.players.find(pguid);
+ LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid);
if (itPlayer != it->second.players.end())
{
// Mark the player/leader of group who left as didn't accept the proposal
@@ -799,7 +799,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
}
// Remove from queue - if proposal is found, RemoveProposal will call RemoveFromQueue
- if (it != m_Proposals.end())
+ if (it != ProposalsStore.end())
RemoveProposal(it, LFG_UPDATETYPE_PROPOSAL_DECLINED);
break;
}
@@ -821,8 +821,8 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
return;
LfgRolesMap check_roles;
- LfgRoleCheckMap::iterator itRoleCheck = m_RoleChecks.find(gguid);
- if (itRoleCheck == m_RoleChecks.end())
+ LfgRoleCheckContainer::iterator itRoleCheck = RoleChecksStore.find(gguid);
+ if (itRoleCheck == RoleChecksStore.end())
return;
LfgRoleCheck& roleCheck = itRoleCheck->second;
@@ -887,12 +887,12 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
SetState(gguid, LFG_STATE_QUEUED);
LFGQueue& queue = GetQueue(gguid);
queue.AddQueueData(gguid, time_t(time(NULL)), roleCheck.dungeons, roleCheck.roles);
- m_RoleChecks.erase(itRoleCheck);
+ RoleChecksStore.erase(itRoleCheck);
}
else if (roleCheck.state != LFG_ROLECHECK_INITIALITING)
{
RestoreState(gguid, "Rolecheck Failed");
- m_RoleChecks.erase(itRoleCheck);
+ RoleChecksStore.erase(itRoleCheck);
}
}
@@ -1007,7 +1007,7 @@ void LFGMgr::MakeNewGroup(const LfgProposal& proposal)
LfgGuidList players;
LfgGuidList playersToTeleport;
- for (LfgProposalPlayerMap::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 guid = it->first;
if (guid == proposal.leader)
@@ -1072,7 +1072,7 @@ void LFGMgr::MakeNewGroup(const LfgProposal& proposal)
uint32 LFGMgr::AddProposal(LfgProposal const& proposal)
{
- m_Proposals[++m_lfgProposalId] = proposal;
+ ProposalsStore[++m_lfgProposalId] = proposal;
return m_lfgProposalId;
}
@@ -1086,14 +1086,14 @@ uint32 LFGMgr::AddProposal(LfgProposal const& proposal)
void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
{
// Check if the proposal exists
- LfgProposalMap::iterator itProposal = m_Proposals.find(proposalId);
- if (itProposal == m_Proposals.end())
+ LfgProposalContainer::iterator itProposal = ProposalsStore.find(proposalId);
+ if (itProposal == ProposalsStore.end())
return;
LfgProposal& proposal = itProposal->second;
// Check if proposal have the current player
- LfgProposalPlayerMap::iterator itProposalPlayer = proposal.players.find(guid);
+ LfgProposalPlayerContainer::iterator itProposalPlayer = proposal.players.find(guid);
if (itProposalPlayer == proposal.players.end())
return;
@@ -1109,13 +1109,13 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
// check if all have answered and reorder players (leader first)
bool allAnswered = true;
- for (LfgProposalPlayerMap::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
+ for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
if (itPlayers->second.accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
allAnswered = false;
if (!allAnswered)
{
- for (LfgProposalPlayerMap::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 guid = it->first;
SendLfgUpdateProposal(guid, proposalId, proposal);
@@ -1129,7 +1129,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
LFGQueue& queue = GetQueue(guid);
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
- for (LfgProposalPlayerMap::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 pguid = it->first;
uint64 gguid = it->second.group;
@@ -1171,7 +1171,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
break;
}
- m_teleport.push_back(pguid);
+ teleportStore.push_back(pguid);
SetState(pguid, LFG_STATE_DUNGEON);
}
@@ -1180,7 +1180,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
queue.RemoveFromQueue(*it);
MakeNewGroup(proposal);
- m_Proposals.erase(itProposal);
+ ProposalsStore.erase(itProposal);
}
/**
@@ -1189,7 +1189,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
@param[in] itProposal Iterator to the proposal to remove
@param[in] type Type of removal (LFG_UPDATETYPE_PROPOSAL_FAILED, LFG_UPDATETYPE_PROPOSAL_DECLINED)
*/
-void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type)
+void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type)
{
LfgProposal& proposal = itProposal->second;
proposal.state = LFG_PROPOSAL_FAILED;
@@ -1197,13 +1197,13 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Proposal %u, state FAILED, UpdateType %u", itProposal->first, type);
// Mark all people that didn't answered as no accept
if (type == LFG_UPDATETYPE_PROPOSAL_FAILED)
- for (LfgProposalPlayerMap::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
if (it->second.accept == LFG_ANSWER_PENDING)
it->second.accept = LFG_ANSWER_DENY;
// Mark players/groups to be removed
LfgGuidSet toRemove;
- for (LfgProposalPlayerMap::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
if (it->second.accept == LFG_ANSWER_AGREE)
continue;
@@ -1218,7 +1218,7 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
}
// Notify players
- for (LfgProposalPlayerMap::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
uint64 guid = it->first;
uint64 gguid = it->second.group ? it->second.group : guid;
@@ -1277,7 +1277,7 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
queue.AddToQueue(guid);
}
- m_Proposals.erase(itProposal);
+ ProposalsStore.erase(itProposal);
}
/**
@@ -1292,7 +1292,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
{
SetState(gguid, LFG_STATE_BOOT);
- LfgPlayerBoot& boot = m_Boots[gguid];
+ LfgPlayerBoot& boot = BootsStore[gguid];
boot.inProgress = true;
boot.cancelTime = time_t(time(NULL)) + LFG_TIME_BOOT;
boot.reason = reason;
@@ -1328,8 +1328,8 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
if (!gguid)
return;
- LfgPlayerBootMap::iterator itBoot = m_Boots.find(gguid);
- if (itBoot == m_Boots.end())
+ LfgPlayerBootContainer::iterator itBoot = BootsStore.find(gguid);
+ if (itBoot == BootsStore.end())
return;
LfgPlayerBoot& boot = itBoot->second;
@@ -1341,7 +1341,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
uint8 votesNum = 0;
uint8 agreeNum = 0;
- for (LfgAnswerMap::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
if (itVotes->second != LFG_ANSWER_PENDING)
{
@@ -1357,7 +1357,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
// Send update info to all players
boot.inProgress = false;
- for (LfgAnswerMap::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
uint64 pguid = itVotes->first;
if (pguid != boot.victim)
@@ -1374,7 +1374,7 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
Player::RemoveFromGroup(group, boot.victim, GROUP_REMOVEMETHOD_KICK_LFG);
DecreaseKicksLeft(gguid);
}
- m_Boots.erase(itBoot);
+ BootsStore.erase(itBoot);
}
/**
@@ -1568,7 +1568,7 @@ const LfgDungeonSet& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
{
LFGDungeonData const* dungeon = GetLFGDungeon(randomdungeon);
uint32 group = dungeon ? dungeon->group : 0;
- return m_CachedDungeonMap[group];
+ return CachedDungeonMapStore[group];
}
/**
@@ -1581,8 +1581,8 @@ const LfgDungeonSet& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level)
{
LfgReward const* rew = NULL;
- LfgRewardMapBounds bounds = m_RewardMap.equal_range(dungeon & 0x00FFFFFF);
- for (LfgRewardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
+ LfgRewardContainerBounds bounds = RewardMapStore.equal_range(dungeon & 0x00FFFFFF);
+ for (LfgRewardContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{
rew = itr->second;
// ordered properly at loading
@@ -1612,9 +1612,9 @@ LfgState LFGMgr::GetState(uint64 guid)
{
LfgState state;
if (IS_GROUP(guid))
- state = m_Groups[guid].GetState();
+ state = GroupsStore[guid].GetState();
else
- state = m_Players[guid].GetState();
+ state = PlayersStore[guid].GetState();
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
return state;
@@ -1622,14 +1622,14 @@ LfgState LFGMgr::GetState(uint64 guid)
uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
{
- uint32 dungeon = m_Groups[guid].GetDungeon(asId);
+ uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
return dungeon;
}
uint32 LFGMgr::GetDungeonMapId(uint64 guid)
{
- uint32 dungeonId = m_Groups[guid].GetDungeon(true);
+ uint32 dungeonId = GroupsStore[guid].GetDungeon(true);
uint32 mapId = 0;
if (dungeonId)
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
@@ -1641,22 +1641,22 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid)
uint8 LFGMgr::GetRoles(uint64 guid)
{
- uint8 roles = m_Players[guid].GetRoles();
+ uint8 roles = PlayersStore[guid].GetRoles();
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
return roles;
}
const std::string& LFGMgr::GetComment(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, m_Players[guid].GetComment().c_str());
- return m_Players[guid].GetComment();
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
+ return PlayersStore[guid].GetComment();
}
bool LFGMgr::IsTeleported(uint64 pguid)
{
- if (std::find(m_teleport.begin(), m_teleport.end(), pguid) != m_teleport.end())
+ if (std::find(teleportStore.begin(), teleportStore.end(), pguid) != teleportStore.end())
{
- m_teleport.remove(pguid);
+ teleportStore.remove(pguid);
return true;
}
return false;
@@ -1665,25 +1665,25 @@ bool LFGMgr::IsTeleported(uint64 pguid)
const LfgDungeonSet& LFGMgr::GetSelectedDungeons(uint64 guid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
- return m_Players[guid].GetSelectedDungeons();
+ return PlayersStore[guid].GetSelectedDungeons();
}
const LfgLockMap& LFGMgr::GetLockedDungeons(uint64 guid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
- return m_Players[guid].GetLockedDungeons();
+ return PlayersStore[guid].GetLockedDungeons();
}
uint8 LFGMgr::GetKicksLeft(uint64 guid)
{
- uint8 kicks = m_Groups[guid].GetKicksLeft();
+ uint8 kicks = GroupsStore[guid].GetKicksLeft();
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
return kicks;
}
void LFGMgr::RestoreState(uint64 guid, char const *debugMsg)
{
- LfgGroupData& data = m_Groups[guid];
+ LfgGroupData& data = GroupsStore[guid];
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
{
std::string const& ps = GetStateString(data.GetState());
@@ -1697,7 +1697,7 @@ void LFGMgr::RestoreState(uint64 guid, char const *debugMsg)
void LFGMgr::ClearState(uint64 guid, char const *debugMsg)
{
- LfgPlayerData& data = m_Players[guid];
+ LfgPlayerData& data = PlayersStore[guid];
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
{
std::string const& ps = GetStateString(data.GetState());
@@ -1712,7 +1712,7 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
{
if (IS_GROUP(guid))
{
- LfgGroupData& data = m_Groups[guid];
+ LfgGroupData& data = GroupsStore[guid];
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
{
std::string const& ns = GetStateString(state);
@@ -1725,7 +1725,7 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
}
else
{
- LfgPlayerData& data = m_Players[guid];
+ LfgPlayerData& data = PlayersStore[guid];
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
{
std::string const& ns = GetStateString(state);
@@ -1741,73 +1741,83 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
- m_Groups[guid].SetDungeon(dungeon);
+ GroupsStore[guid].SetDungeon(dungeon);
}
void LFGMgr::SetRoles(uint64 guid, uint8 roles)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
- m_Players[guid].SetRoles(roles);
+ PlayersStore[guid].SetRoles(roles);
}
void LFGMgr::SetComment(uint64 guid, const std::string& comment)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
- m_Players[guid].SetComment(comment);
+ PlayersStore[guid].SetComment(comment);
}
void LFGMgr::SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
- m_Players[guid].SetSelectedDungeons(dungeons);
+ PlayersStore[guid].SetSelectedDungeons(dungeons);
}
void LFGMgr::SetLockedDungeons(uint64 guid, const LfgLockMap& lock)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
- m_Players[guid].SetLockedDungeons(lock);
+ PlayersStore[guid].SetLockedDungeons(lock);
}
void LFGMgr::DecreaseKicksLeft(uint64 guid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
- m_Groups[guid].DecreaseKicksLeft();
+ GroupsStore[guid].DecreaseKicksLeft();
}
void LFGMgr::RemovePlayerData(uint64 guid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
- LfgPlayerDataMap::iterator it = m_Players.find(guid);
- if (it != m_Players.end())
- m_Players.erase(it);
+ LfgPlayerDataContainer::iterator it = PlayersStore.find(guid);
+ if (it != PlayersStore.end())
+ PlayersStore.erase(it);
}
void LFGMgr::RemoveGroupData(uint64 guid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
- LfgGroupDataMap::iterator it = m_Groups.find(guid);
- if (it != m_Groups.end())
- m_Groups.erase(it);
+ LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
+ if (it == GroupsStore.end())
+ return;
+
+ LfgGuidSet const& players = it->second.GetPlayers();
+ for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
+ {
+ uint64 guid = (*it);
+ ClearState(*it, "Group Disband");
+ SetGroup(*it, 0);
+ SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
+ }
+ GroupsStore.erase(it);
}
uint8 LFGMgr::GetTeam(uint64 guid)
{
- return m_Players[guid].GetTeam();
+ return PlayersStore[guid].GetTeam();
}
uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid)
{
- return m_Groups[gguid].RemovePlayer(guid);
+ return GroupsStore[gguid].RemovePlayer(guid);
}
void LFGMgr::AddPlayerToGroup(uint64 gguid, uint64 guid)
{
- m_Groups[gguid].AddPlayer(guid);
+ GroupsStore[gguid].AddPlayer(guid);
}
void LFGMgr::SetLeader(uint64 gguid, uint64 leader)
{
- m_Groups[gguid].SetLeader(leader);
+ GroupsStore[gguid].SetLeader(leader);
}
void LFGMgr::SetTeam(uint64 guid, uint8 team)
@@ -1815,32 +1825,32 @@ void LFGMgr::SetTeam(uint64 guid, uint8 team)
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
team = 0;
- m_Players[guid].SetTeam(team);
+ PlayersStore[guid].SetTeam(team);
}
uint64 LFGMgr::GetGroup(uint64 guid)
{
- return m_Players[guid].GetGroup();
+ return PlayersStore[guid].GetGroup();
}
void LFGMgr::SetGroup(uint64 guid, uint64 group)
{
- m_Players[guid].SetGroup(group);
+ PlayersStore[guid].SetGroup(group);
}
LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid)
{
- return m_Groups[guid].GetPlayers();
+ return GroupsStore[guid].GetPlayers();
}
uint8 LFGMgr::GetPlayerCount(uint64 guid)
{
- return m_Groups[guid].GetPlayerCount();
+ return GroupsStore[guid].GetPlayerCount();
}
uint64 LFGMgr::GetLeader(uint64 guid)
{
- return m_Groups[guid].GetLeader();
+ return GroupsStore[guid].GetLeader();
}
bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2)
@@ -1902,7 +1912,7 @@ void LFGMgr::SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data)
bool LFGMgr::IsLfgGroup(uint64 guid)
{
- return guid && IS_GROUP(guid) && m_Groups[guid].IsLfgGroup();
+ return guid && IS_GROUP(guid) && GroupsStore[guid].IsLfgGroup();
}
LFGQueue& LFGMgr::GetQueue(uint64 guid)
@@ -1917,7 +1927,7 @@ LFGQueue& LFGMgr::GetQueue(uint64 guid)
}
else
queueId = GetTeam(guid);
- return m_Queues[queueId];
+ return QueuesStore[queueId];
}
bool LFGMgr::AllQueued(LfgGuidList const& check)
@@ -1934,7 +1944,7 @@ bool LFGMgr::AllQueued(LfgGuidList const& check)
// Only for debugging purposes
void LFGMgr::Clean()
{
- m_Queues.clear();
+ QueuesStore.clear();
}
bool LFGMgr::isOptionEnabled(uint32 option)
@@ -1954,7 +1964,7 @@ void LFGMgr::SetOptions(uint32 options)
LfgState LFGMgr::GetLfgStatus(uint64 guid, LfgUpdateData& data)
{
- LfgPlayerData& playerData = m_Players[guid];
+ LfgPlayerData& playerData = PlayersStore[guid];
data.dungeons = playerData.GetSelectedDungeons();
return playerData.GetState();
}
@@ -1977,11 +1987,11 @@ bool LFGMgr::IsSeasonActive(uint32 dungeonId)
std::string LFGMgr::DumpQueueInfo(bool full)
{
- uint32 size = uint32(m_Queues.size());
+ uint32 size = uint32(QueuesStore.size());
std::ostringstream o;
o << "Number of Queues: " << size << "\n";
- for (LfgQueueMap::const_iterator itr = m_Queues.begin(); itr != m_Queues.end(); ++itr)
+ for (LfgQueueContainer::const_iterator itr = QueuesStore.begin(); itr != QueuesStore.end(); ++itr)
{
std::string const& queued = itr->second.DumpQueueInfo();
std::string const& compatibles = itr->second.DumpCompatibleInfo(full);
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 32922f137bf..ba1cc251278 100755
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -129,18 +129,18 @@ struct LfgProposal;
struct LfgProposalPlayer;
struct LfgPlayerBoot;
-typedef std::map<uint8, LFGQueue> LfgQueueMap;
-typedef std::multimap<uint32, LfgReward const*> LfgRewardMap;
-typedef std::pair<LfgRewardMap::const_iterator, LfgRewardMap::const_iterator> LfgRewardMapBounds;
-typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonMap;
-typedef std::map<uint64, LfgAnswer> LfgAnswerMap;
-typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckMap;
-typedef std::map<uint32, LfgProposal> LfgProposalMap;
-typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerMap;
-typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootMap;
-typedef std::map<uint64, LfgGroupData> LfgGroupDataMap;
-typedef std::map<uint64, LfgPlayerData> LfgPlayerDataMap;
-typedef UNORDERED_MAP<uint32, LFGDungeonData> LFGDungeonMap;
+typedef std::map<uint8, LFGQueue> LfgQueueContainer;
+typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
+typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
+typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
+typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
+typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
+typedef std::map<uint32, LfgProposal> LfgProposalContainer;
+typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
+typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
+typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
+typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
+typedef UNORDERED_MAP<uint32, LFGDungeonData> LFGDungeonContainer;
// Data needed by SMSG_LFG_JOIN_RESULT
struct LfgJoinResultData
@@ -231,7 +231,7 @@ struct LfgProposal
uint32 encounters; ///< Dungeon Encounters
bool isNew; ///< Determines if it's new group or not
LfgGuidList queues; ///< Queue Ids to remove/readd
- LfgProposalPlayerMap players; ///< Players data
+ LfgProposalPlayerContainer players; ///< Players data
};
/// Stores all rolecheck info of a group that wants to join
@@ -250,7 +250,7 @@ struct LfgPlayerBoot
{
time_t cancelTime; ///< Time left to vote
bool inProgress; ///< Vote in progress
- LfgAnswerMap votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
+ LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
uint64 victim; ///< Player guid to be kicked (can't vote)
std::string reason; ///< kick reason
};
@@ -371,7 +371,7 @@ class LFGMgr
void LoadLFGDungeons(bool reload = false);
LFGDungeonData const* GetLFGDungeon(uint32 id);
- LFGDungeonMap& GetLFGDungeonMap();
+ LFGDungeonContainer& GetLFGDungeonMap();
void SetupGroupMember(uint64 guid, uint64 gguid);
uint64 GetGroup(uint64 guid);
@@ -385,7 +385,7 @@ class LFGMgr
void DecreaseKicksLeft(uint64 guid);
// Proposals
- void RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type);
+ void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type);
void MakeNewGroup(LfgProposal const& proposal);
// Generic
@@ -406,18 +406,18 @@ class LFGMgr
uint32 m_lfgProposalId; ///< used as internal counter for proposals
uint32 m_options; ///< Stores config options
- LfgQueueMap m_Queues; ///< Queues
- LfgCachedDungeonMap m_CachedDungeonMap; ///< Stores all dungeons by groupType
+ LfgQueueContainer QueuesStore; ///< Queues
+ LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType
// Reward System
- LfgRewardMap m_RewardMap; ///< Stores rewards for random dungeons
- LFGDungeonMap m_LfgDungeonMap;
+ LfgRewardContainer RewardMapStore; ///< Stores rewards for random dungeons
+ LFGDungeonContainer LfgDungeonStore;
// Rolecheck - Proposal - Vote Kicks
- LfgRoleCheckMap m_RoleChecks; ///< Current Role checks
- LfgProposalMap m_Proposals; ///< Current Proposals
- LfgPlayerBootMap m_Boots; ///< Current player kicks
- LfgPlayerDataMap m_Players; ///< Player data
- LfgGroupDataMap m_Groups; ///< Group data
- LfgGuidList m_teleport; ///< Players being teleported
+ LfgRoleCheckContainer RoleChecksStore; ///< Current Role checks
+ LfgProposalContainer ProposalsStore; ///< Current Proposals
+ LfgPlayerBootContainer BootsStore; ///< Current player kicks
+ LfgPlayerDataContainer PlayersStore; ///< Player data
+ LfgGroupDataContainer GroupsStore; ///< Group data
+ LfgGuidList teleportStore; ///< Players being teleported
};
#define sLFGMgr ACE_Singleton<LFGMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
index b5775bba167..8b69b537102 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -82,8 +82,8 @@ char const* GetCompatibleString(LfgCompatibility compatibles)
void LFGQueue::AddToQueue(uint64 guid)
{
- LfgQueueDataMap::iterator itQueue = m_QueueDataMap.find(guid);
- if (itQueue == m_QueueDataMap.end())
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
+ if (itQueue == QueueDataStore.end())
{
sLog->outError(LOG_FILTER_LFG, "LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
return;
@@ -102,8 +102,8 @@ void LFGQueue::RemoveFromQueue(uint64 guid)
o << guid;
std::string sguid = o.str();
- LfgQueueDataMap::iterator itDelete = m_QueueDataMap.end();
- for (LfgQueueDataMap::iterator itr = m_QueueDataMap.begin(); itr != m_QueueDataMap.end(); ++itr)
+ LfgQueueDataContainer::iterator itDelete = QueueDataStore.end();
+ for (LfgQueueDataContainer::iterator itr = QueueDataStore.begin(); itr != QueueDataStore.end(); ++itr)
if (itr->first != guid)
{
if (std::string::npos != itr->second.bestCompatible.find(sguid))
@@ -115,67 +115,67 @@ void LFGQueue::RemoveFromQueue(uint64 guid)
else
itDelete = itr;
- if (itDelete != m_QueueDataMap.end())
- m_QueueDataMap.erase(itDelete);
+ if (itDelete != QueueDataStore.end())
+ QueueDataStore.erase(itDelete);
}
void LFGQueue::AddToNewQueue(uint64 guid)
{
- m_newToQueue.push_back(guid);
+ newToQueueStore.push_back(guid);
}
void LFGQueue::RemoveFromNewQueue(uint64 guid)
{
- m_newToQueue.remove(guid);
+ newToQueueStore.remove(guid);
}
void LFGQueue::AddToCurrentQueue(uint64 guid)
{
- m_currentQueue.push_back(guid);
+ currentQueueStore.push_back(guid);
}
void LFGQueue::RemoveFromCurrentQueue(uint64 guid)
{
- m_currentQueue.remove(guid);
+ currentQueueStore.remove(guid);
}
void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, const LfgDungeonSet &dungeons, const LfgRolesMap &rolesMap)
{
- m_QueueDataMap[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
+ QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
AddToQueue(guid);
}
void LFGQueue::RemoveQueueData(uint64 guid)
{
- LfgQueueDataMap::iterator it = m_QueueDataMap.find(guid);
- if (it != m_QueueDataMap.end())
- m_QueueDataMap.erase(it);
+ LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
+ if (it != QueueDataStore.end())
+ QueueDataStore.erase(it);
}
void LFGQueue::UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId)
{
- LfgWaitTime &wt = m_waitTimesAvg[dungeonId];
+ LfgWaitTime &wt = waitTimesAvgStore[dungeonId];
uint32 old_number = wt.number++;
wt.time = int32((wt.time * old_number + waitTime) / wt.number);
}
void LFGQueue::UpdateWaitTimeTank(int32 waitTime, uint32 dungeonId)
{
- LfgWaitTime &wt = m_waitTimesTank[dungeonId];
+ LfgWaitTime &wt = waitTimesTankStore[dungeonId];
uint32 old_number = wt.number++;
wt.time = int32((wt.time * old_number + waitTime) / wt.number);
}
void LFGQueue::UpdateWaitTimeHealer(int32 waitTime, uint32 dungeonId)
{
- LfgWaitTime &wt = m_waitTimesHealer[dungeonId];
+ LfgWaitTime &wt = waitTimesHealerStore[dungeonId];
uint32 old_number = wt.number++;
wt.time = int32((wt.time * old_number + waitTime) / wt.number);
}
void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId)
{
- LfgWaitTime &wt = m_waitTimesDps[dungeonId];
+ LfgWaitTime &wt = waitTimesDpsStore[dungeonId];
uint32 old_number = wt.number++;
wt.time = int32((wt.time * old_number + waitTime) / wt.number);
}
@@ -192,11 +192,11 @@ void LFGQueue::RemoveFromCompatibles(uint64 guid)
std::string strGuid = out.str();
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::RemoveFromCompatibles: Removing [" UI64FMTD "]", guid);
- for (LfgCompatibleMap::iterator itNext = m_CompatibleMap.begin(); itNext != m_CompatibleMap.end();)
+ for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();)
{
- LfgCompatibleMap::iterator it = itNext++;
+ LfgCompatibleContainer::iterator it = itNext++;
if (std::string::npos != it->first.find(strGuid))
- m_CompatibleMap.erase(it);
+ CompatibleMapStore.erase(it);
}
}
@@ -208,13 +208,13 @@ void LFGQueue::RemoveFromCompatibles(uint64 guid)
*/
void LFGQueue::SetCompatibles(std::string const& key, LfgCompatibility compatibles)
{
- LfgCompatibilityData& data = m_CompatibleMap[key];
+ LfgCompatibilityData& data = CompatibleMapStore[key];
data.compatibility = compatibles;
}
void LFGQueue::SetCompatibilityData(std::string const& key, LfgCompatibilityData const& data)
{
- m_CompatibleMap[key] = data;
+ CompatibleMapStore[key] = data;
}
@@ -226,8 +226,8 @@ void LFGQueue::SetCompatibilityData(std::string const& key, LfgCompatibilityData
*/
LfgCompatibility LFGQueue::GetCompatibles(std::string const& key)
{
- LfgCompatibleMap::iterator itr = m_CompatibleMap.find(key);
- if (itr != m_CompatibleMap.end())
+ LfgCompatibleContainer::iterator itr = CompatibleMapStore.find(key);
+ if (itr != CompatibleMapStore.end())
return itr->second.compatibility;
return LFG_COMPATIBILITY_PENDING;
@@ -235,8 +235,8 @@ LfgCompatibility LFGQueue::GetCompatibles(std::string const& key)
LfgCompatibilityData* LFGQueue::GetCompatibilityData(std::string const& key)
{
- LfgCompatibleMap::iterator itr = m_CompatibleMap.find(key);
- if (itr != m_CompatibleMap.end())
+ LfgCompatibleContainer::iterator itr = CompatibleMapStore.find(key);
+ if (itr != CompatibleMapStore.end())
return &(itr->second);
return NULL;
@@ -246,15 +246,15 @@ uint8 LFGQueue::FindGroups()
{
uint8 proposals = 0;
LfgGuidList firstNew;
- while (!m_newToQueue.empty())
+ while (!newToQueueStore.empty())
{
- uint64 frontguid = m_newToQueue.front();
- sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindGroups: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(m_newToQueue.size()), uint32(m_currentQueue.size()));
+ uint64 frontguid = newToQueueStore.front();
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindGroups: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size()));
firstNew.clear();
firstNew.push_back(frontguid);
RemoveFromNewQueue(frontguid);
- LfgGuidList temporalList = m_currentQueue;
+ LfgGuidList temporalList = currentQueueStore;
LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList);
if (compatibles == LFG_COMPATIBLES_MATCH)
@@ -348,8 +348,8 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
{
uint64 guid = (*it);
- LfgQueueDataMap::iterator itQueue = m_QueueDataMap.find(guid);
- if (itQueue == m_QueueDataMap.end())
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
+ if (itQueue == QueueDataStore.end())
{
sLog->outError(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid);
RemoveFromQueue(guid);
@@ -374,7 +374,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
if (check.size() == 1 && numPlayers != MAXGROUPSIZE)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) sigle group. Compatibles", strGuids.c_str());
- LfgQueueDataMap::iterator itQueue = m_QueueDataMap.find(check.front());
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
data.roles = itQueue->second.roles;
@@ -404,7 +404,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
{
for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
{
- const LfgRolesMap &roles = m_QueueDataMap[(*it)].roles;
+ const LfgRolesMap &roles = QueueDataStore[(*it)].roles;
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
{
LfgRolesMap::const_iterator itPlayer;
@@ -440,13 +440,13 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
}
LfgGuidList::iterator itguid = check.begin();
- proposalDungeons = m_QueueDataMap[*itguid].dungeons;
+ proposalDungeons = QueueDataStore[*itguid].dungeons;
std::ostringstream o;
o << ", " << *itguid << ": (" << sLFGMgr->ConcatenateDungeons(proposalDungeons) << ")";
for (++itguid; itguid != check.end(); ++itguid)
{
LfgDungeonSet temporal;
- LfgDungeonSet &dungeons = m_QueueDataMap[*itguid].dungeons;
+ LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons;
o << ", " << *itguid << ": (" << sLFGMgr->ConcatenateDungeons(dungeons) << ")";
std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
proposalDungeons = temporal;
@@ -462,7 +462,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
else
{
uint64 gguid = *check.begin();
- const LfgQueueData &queue = m_QueueDataMap[gguid];
+ const LfgQueueData &queue = QueueDataStore[gguid];
proposalDungeons = queue.dungeons;
proposalRoles = queue.roles;
LFGMgr::CheckGroupRoles(proposalRoles); // assing new roles
@@ -472,13 +472,13 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
if (numPlayers != MAXGROUPSIZE)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Compatibles but not enough players(%u)", strGuids.c_str(), numPlayers);
- LfgQueueDataMap::iterator itQueue = m_QueueDataMap.find(check.front());
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
data.roles = proposalRoles;
for (LfgGuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr)
- UpdateBestCompatibleInQueue(m_QueueDataMap.find(*itr), strGuids, data.roles);
+ UpdateBestCompatibleInQueue(QueueDataStore.find(*itr), strGuids, data.roles);
SetCompatibilityData(strGuids, data);
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
@@ -544,17 +544,17 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
void LFGQueue::UpdateQueueTimers(time_t currTime)
{
sLog->outTrace(LOG_FILTER_LFG, "Updating queue timers...");
- for (LfgQueueDataMap::iterator itQueue = m_QueueDataMap.begin(); itQueue != m_QueueDataMap.end(); ++itQueue)
+ for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ++itQueue)
{
LfgQueueData& queueinfo = itQueue->second;
uint32 dungeonId = (*queueinfo.dungeons.begin());
uint32 queuedTime = uint32(currTime - queueinfo.joinTime);
uint8 role = PLAYER_ROLE_NONE;
int32 waitTime = -1;
- int32 wtTank = m_waitTimesTank[dungeonId].time;
- int32 wtHealer = m_waitTimesHealer[dungeonId].time;
- int32 wtDps = m_waitTimesDps[dungeonId].time;
- int32 wtAvg = m_waitTimesAvg[dungeonId].time;
+ int32 wtTank = waitTimesTankStore[dungeonId].time;
+ int32 wtHealer = waitTimesHealerStore[dungeonId].time;
+ int32 wtDps = waitTimesDpsStore[dungeonId].time;
+ int32 wtAvg = waitTimesAvgStore[dungeonId].time;
for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
role |= itPlayer->second;
@@ -593,7 +593,7 @@ void LFGQueue::UpdateQueueTimers(time_t currTime)
time_t LFGQueue::GetJoinTime(uint64 guid)
{
- return m_QueueDataMap[guid].joinTime;
+ return QueueDataStore[guid].joinTime;
}
std::string LFGQueue::DumpQueueInfo() const
@@ -604,7 +604,7 @@ std::string LFGQueue::DumpQueueInfo() const
for (uint8 i = 0; i < 2; ++i)
{
- LfgGuidList const& queue = i ? m_newToQueue : m_currentQueue;
+ LfgGuidList const& queue = i ? newToQueueStore : currentQueueStore;
for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
{
uint64 guid = *it;
@@ -625,22 +625,22 @@ std::string LFGQueue::DumpQueueInfo() const
std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const
{
std::ostringstream o;
- o << "Compatible Map size: " << m_CompatibleMap.size() << "\n";
+ o << "Compatible Map size: " << CompatibleMapStore.size() << "\n";
if (full)
- for (LfgCompatibleMap::const_iterator itr = m_CompatibleMap.begin(); itr != m_CompatibleMap.end(); ++itr)
+ for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
o << "(" << itr->first << "): " << GetCompatibleString(itr->second.compatibility) << "\n";
return o.str();
}
-void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataMap::iterator itrQueue)
+void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindBestCompatibleInQueue: " UI64FMTD, itrQueue->first);
std::ostringstream o;
o << itrQueue->first;
std::string sguid = o.str();
- for (LfgCompatibleMap::const_iterator itr = m_CompatibleMap.begin(); itr != m_CompatibleMap.end(); ++itr)
+ for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
if (itr->second.compatibility == LFG_COMPATIBLES_WITH_LESS_PLAYERS &&
std::string::npos != itr->first.find(sguid))
{
@@ -648,7 +648,7 @@ void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataMap::iterator itrQueue)
}
}
-void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataMap::iterator itrQueue, std::string const& key, LfgRolesMap const& roles)
+void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles)
{
LfgQueueData& queueData = itrQueue->second;
@@ -657,9 +657,6 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataMap::iterator itrQueue, s
uint8 size = std::count(key.begin(), key.end(), '|') + 1;
- sLog->outDebug(LOG_FILTER_LFG, "SPP: GUID: " UI64FMTD ", storedSize = %u, size = %u, BestGroup %s",
- itrQueue->first, storedSize, size, queueData.bestCompatible.c_str());
-
if (size <= storedSize)
return;
diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h
index 7c47519d79e..f937ac0d21a 100644
--- a/src/server/game/DungeonFinding/LFGQueue.h
+++ b/src/server/game/DungeonFinding/LFGQueue.h
@@ -73,9 +73,9 @@ struct LfgWaitTime
uint32 number; ///< Number of people used to get that wait time
};
-typedef std::map<uint32, LfgWaitTime> LfgWaitTimesMap;
-typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleMap;
-typedef std::map<uint64, LfgQueueData> LfgQueueDataMap;
+typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
+typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer;
+typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
/**
Stores all data related to queue
@@ -122,22 +122,22 @@ class LFGQueue
void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles);
LfgCompatibilityData* GetCompatibilityData(std::string const& key);
- void FindBestCompatibleInQueue(LfgQueueDataMap::iterator itrQueue);
- void UpdateBestCompatibleInQueue(LfgQueueDataMap::iterator itrQueue, std::string const& key, LfgRolesMap const& roles);
+ void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
+ void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles);
LfgCompatibility FindNewGroups(LfgGuidList& check, LfgGuidList& all);
LfgCompatibility CheckCompatibility(LfgGuidList check);
// Queue
- LfgQueueDataMap m_QueueDataMap; ///< Queued groups
- LfgCompatibleMap m_CompatibleMap; ///< Compatible dungeons
-
- LfgWaitTimesMap m_waitTimesAvg; ///< Average wait time to find a group queuing as multiple roles
- LfgWaitTimesMap m_waitTimesTank; ///< Average wait time to find a group queuing as tank
- LfgWaitTimesMap m_waitTimesHealer; ///< Average wait time to find a group queuing as healer
- LfgWaitTimesMap m_waitTimesDps; ///< Average wait time to find a group queuing as dps
- LfgGuidList m_currentQueue; ///< Ordered list. Used to find groups
- LfgGuidList m_newToQueue; ///< New groups to add to queue
+ LfgQueueDataContainer QueueDataStore; ///< Queued groups
+ LfgCompatibleContainer CompatibleMapStore; ///< Compatible dungeons
+
+ LfgWaitTimesContainer waitTimesAvgStore; ///< Average wait time to find a group queuing as multiple roles
+ LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank
+ LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer
+ LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps
+ LfgGuidList currentQueueStore; ///< Ordered list. Used to find groups
+ LfgGuidList newToQueueStore; ///< New groups to add to queue
};
#endif
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 4d814365dae..d3dc96a801b 100755
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -162,8 +162,8 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data
uint8 level = GetPlayer()->getLevel();
uint8 expansion = GetPlayer()->GetSession()->Expansion();
- LFGDungeonMap& LfgDungeons = sLFGMgr->GetLFGDungeonMap();
- for (LFGDungeonMap::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr)
+ LFGDungeonContainer& LfgDungeons = sLFGMgr->GetLFGDungeonMap();
+ for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr)
{
LFGDungeonData const& dungeon = itr->second;
if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id)))
@@ -513,7 +513,7 @@ void WorldSession::SendLfgBootProposalUpdate(const LfgPlayerBoot& boot)
uint8 votesNum = 0;
uint8 agreeNum = 0;
uint32 secsleft = uint8((boot.cancelTime - time(NULL)) / 1000);
- for (LfgAnswerMap::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it)
+ for (LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it)
{
if (it->second != LFG_ANSWER_PENDING)
{
@@ -565,7 +565,7 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p
data << uint8(silent); // Show proposal window
data << uint8(proposal.players.size()); // Group size
- for (LfgProposalPlayerMap::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
LfgProposalPlayer const& player = it->second;
data << uint32(player.role); // Role