From 52a5c5e8e3534d4c5d33076ab321dc654d77fa85 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 26 Mar 2009 20:33:01 -0600 Subject: *Some improvement of update visibility when players leave map. --HG-- branch : trunk --- src/game/Map.cpp | 20 ++++++++++++++++---- src/game/Player.cpp | 11 ----------- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/game/Map.cpp b/src/game/Map.cpp index afc9fea0ce1..c1cd4da191a 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -469,6 +469,8 @@ bool Map::Add(Player *player) SendInitSelf(player); SendInitTransports(player); + player->m_IsInNotifyList = false; + player->m_Notified = false; AddNotifier(player); return true; @@ -614,8 +616,20 @@ void Map::RelocationNotify() for(std::vector::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter) { Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL); - if(!unit || !unit->IsInWorld() || !unit->GetMapId() == GetId()) + if(!unit || unit->GetMapId() != GetId()) + { + *iter = 0; + continue; + } + + if(!unit->IsInWorld()) { + //other objs are done during remove + if(unit->GetTypeId() == TYPEID_PLAYER) + { + Trinity::VisibleChangesNotifier notifier(*unit); + VisitWorld(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + } *iter = 0; continue; } @@ -798,9 +812,7 @@ void Map::Update(const uint32 &t_diff) void Map::Remove(Player *player, bool remove) { - player->DestroyForNearbyPlayers(); - player->m_IsInNotifyList = false; - player->m_Notified = false; + AddUnitToNotify(player); // this may be called during Map::Update // after decrement+unlink, ++m_mapRefIter will continue correctly diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c163026b08f..764cb20c88c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1714,17 +1714,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati ResetContestedPvP(); - /*DestroyForNearbyPlayers(); - { - UpdateData data; - for(ClientGUIDs::iterator i = m_clientGUIDs.begin(); i != m_clientGUIDs.end(); ++i) - data.AddOutOfRangeGUID(*i); - WorldPacket packet; - data.BuildPacket(&packet); - GetSession()->SendPacket(&packet); - }*/ - m_clientGUIDs.clear(); - // remove player from battleground on far teleport (when changing maps) if(BattleGround const* bg = GetBattleGround()) { -- cgit v1.2.3