Core/ObjectMgr: Remove GetPlayer function (Remove double use of singletons)

This commit is contained in:
Spp-
2011-07-27 12:14:27 +02:00
parent fa50c0a464
commit b2a84d9f1e
47 changed files with 166 additions and 168 deletions
@@ -283,7 +283,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg
//remove player from queue and from group info, if group info is empty then remove it too
void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount)
{
//Player *plr = sObjectMgr->GetPlayer(guid);
//Player *plr = ObjectAccessor::FindPlayer(guid);
int32 bracket_id = -1; // signed for proper for-loop finish
QueuedPlayersMap::iterator itr;
@@ -366,7 +366,7 @@ void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
if (at)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
Player *plr = sObjectMgr->GetPlayer(guid);
Player *plr = ObjectAccessor::FindPlayer(guid);
if (plr)
at->MemberLost(plr, group->OpponentsMatchmakerRating);
else
@@ -388,7 +388,7 @@ void BattlegroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
{
// remove next player, this is recursive
// first send removal information
if (Player *plr2 = sObjectMgr->GetPlayer(group->Players.begin()->first))
if (Player *plr2 = ObjectAccessor::FindPlayer(group->Players.begin()->first))
{
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(group->BgTypeId);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
@@ -447,7 +447,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, Battleground* bg
for (std::map<uint64, PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
// get the player
Player* plr = sObjectMgr->GetPlayer(itr->first);
Player* plr = ObjectAccessor::FindPlayer(itr->first);
// if offline, skip him, this should not happen - player is removed from queue when he logs out
if (!plr)
continue;
@@ -1022,7 +1022,7 @@ void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketI
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = sObjectMgr->GetPlayer(m_PlayerGuid);
Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
if (!plr)
return true;
@@ -1065,7 +1065,7 @@ void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
*/
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = sObjectMgr->GetPlayer(m_PlayerGuid);
Player* plr = ObjectAccessor::FindPlayer(m_PlayerGuid);
if (!plr)
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
return true;