From 865f35a63702d5ab723cfbc2ea5a5f3e76e2f344 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 13 Dec 2010 21:28:36 +0100 Subject: Core/Dungeon Finder: Minor optimization in handler code Note: LfgDungeonSet and LfgLockStatusMap were being used without using the existing typedef (to avoid including LFGMgr.h). Now those functions use a struct as param that is forward declared so still LFGMgr.h is not needed and redefinition of LfgDungeonSet/LfgLockStatusMap is removed. --HG-- branch : trunk --- src/server/game/DungeonFinding/LFGScripts.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/server/game/DungeonFinding/LFGScripts.cpp') diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index d9f81435e93..555ead9b8c4 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -36,12 +36,13 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid) return; sLog.outDebug("LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "]", gguid, guid); + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_CLEAR_LOCK_LIST); for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { if (Player *plrg = itr->getSource()) { - plrg->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_CLEAR_LOCK_LIST); - plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_CLEAR_LOCK_LIST); + plrg->GetSession()->SendLfgUpdatePlayer(updateData); + plrg->GetSession()->SendLfgUpdateParty(updateData); } } @@ -90,7 +91,8 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod& method, */ plr->ClearLfgState(); - plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER); + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER); + plr->GetSession()->SendLfgUpdateParty(updateData); if (plr->GetMap()->IsDungeon()) // Teleport player out the dungeon sLFGMgr.TeleportPlayer(plr, true); } @@ -111,12 +113,18 @@ void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLe sLog.outDebug("LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); Player *plr = sObjectMgr.GetPlayer(newLeaderGuid); + + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER); if (plr) - plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER); + plr->GetSession()->SendLfgUpdateParty(updateData); + plr = sObjectMgr.GetPlayer(oldLeaderGuid); if (plr) - plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_GROUP_DISBAND); + { + updateData.updateType = LFG_UPDATETYPE_GROUP_DISBAND; + plr->GetSession()->SendLfgUpdateParty(updateData); + } } void LFGScripts::OnInviteMember(Group* group, uint64 guid) @@ -137,12 +145,13 @@ void LFGScripts::OnLevelChanged(Player* /*player*/, uint8 /*newLevel*/) void LFGScripts::OnLogout(Player* player) { sLFGMgr.Leave(player); - player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); - player->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); + LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); + player->GetSession()->SendLfgUpdateParty(updateData); + player->GetSession()->SendLfgUpdatePlayer(updateData); player->GetSession()->SendLfgUpdateSearch(false); } void LFGScripts::OnLogin(Player* /*player*/) { // TODO - Restore LfgPlayerData and send proper status to player if it was in a group -} \ No newline at end of file +} -- cgit v1.2.3