diff options
author | Spp <none@none> | 2010-12-13 21:28:36 +0100 |
---|---|---|
committer | Spp <none@none> | 2010-12-13 21:28:36 +0100 |
commit | 865f35a63702d5ab723cfbc2ea5a5f3e76e2f344 (patch) | |
tree | 62dd4d8a593073d50309c5435c91a90d294bd7e3 /src/server/game/DungeonFinding/LFGScripts.cpp | |
parent | 9815847511b131f8ae550a9594fdab37970a193a (diff) |
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
Diffstat (limited to 'src/server/game/DungeonFinding/LFGScripts.cpp')
-rw-r--r-- | src/server/game/DungeonFinding/LFGScripts.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
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 +} |