aboutsummaryrefslogtreecommitdiff
path: root/src/game/ObjectAccessor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/ObjectAccessor.cpp')
-rw-r--r--src/game/ObjectAccessor.cpp126
1 files changed, 1 insertions, 125 deletions
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index f2be4153af6..365115fcb8f 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -184,65 +184,6 @@ ObjectAccessor::SaveAllPlayers()
itr->second->SaveToDB();
}
-void
-ObjectAccessor::UpdateObject(Object* obj, Player* exceptPlayer)
-{
- UpdateDataMapType update_players;
- obj->BuildUpdate(update_players);
-
- WorldPacket packet;
- for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
- {
- if(iter->first == exceptPlayer)
- continue;
-
- iter->second.BuildPacket(&packet);
- iter->first->GetSession()->SendPacket(&packet);
- packet.clear();
- }
-}
-
-void
-ObjectAccessor::_buildUpdateObject(Object *obj, UpdateDataMapType &update_players)
-{
- if(obj->isType(TYPEMASK_ITEM))
- {
- if(Player *owner = ((Item*)obj)->GetOwner())
- _buildPacket(owner, obj, update_players);
- }
- else
- _buildChangeObjectForPlayer((WorldObject*)obj, update_players);
-}
-
-void
-ObjectAccessor::_buildPacket(Player *pl, Object *obj, UpdateDataMapType &update_players)
-{
- UpdateDataMapType::iterator iter = update_players.find(pl);
-
- if( iter == update_players.end() )
- {
- std::pair<UpdateDataMapType::iterator, bool> p = update_players.insert( UpdateDataValueType(pl, UpdateData()) );
- assert(p.second);
- iter = p.first;
- }
-
- obj->BuildValuesUpdateBlockForPlayer(&iter->second, iter->first);
-}
-
-void
-ObjectAccessor::_buildChangeObjectForPlayer(WorldObject *obj, UpdateDataMapType &update_players)
-{
- CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
- WorldObjectChangeAccumulator notifier(*obj, update_players);
- TypeContainerVisitor<WorldObjectChangeAccumulator, WorldTypeMapContainer > player_notifier(notifier);
- Map& map = *obj->GetMap();
- //we must build packets for all visible players
- cell.Visit(p, player_notifier, map, *obj, map.GetVisibilityDistance());
-}
-
Pet*
ObjectAccessor::GetPet(uint64 guid)
{
@@ -408,8 +349,7 @@ ObjectAccessor::Update(uint32 diff)
Object* obj = *i_objects.begin();
assert(obj && obj->IsInWorld());
i_objects.erase(i_objects.begin());
- _buildUpdateObject(obj, update_players);
- obj->ClearUpdateMask(false);
+ obj->BuildUpdate(update_players);
}
}
@@ -422,70 +362,6 @@ ObjectAccessor::Update(uint32 diff)
}
}
-void
-ObjectAccessor::WorldObjectChangeAccumulator::Visit(PlayerMapType &m)
-{
- for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
- {
- BuildPacket(iter->getSource());
- if (!iter->getSource()->GetSharedVisionList().empty())
- {
- SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin();
- for (; it != iter->getSource()->GetSharedVisionList().end(); ++it)
- BuildPacket(*it);
- }
- }
-}
-
-void
-ObjectAccessor::WorldObjectChangeAccumulator::Visit(CreatureMapType &m)
-{
- for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
- {
- if (!iter->getSource()->GetSharedVisionList().empty())
- {
- SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin();
- for (; it != iter->getSource()->GetSharedVisionList().end(); ++it)
- BuildPacket(*it);
- }
- }
-}
-
-void
-ObjectAccessor::WorldObjectChangeAccumulator::Visit(DynamicObjectMapType &m)
-{
- for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
- {
- uint64 guid = iter->getSource()->GetCasterGUID();
- if(IS_PLAYER_GUID(guid))
- {
- //Caster may be NULL if DynObj is in removelist
- if(Player *caster = FindPlayer(guid))
- if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID())
- BuildPacket(caster);
- }
- }
-}
-
-void
-ObjectAccessor::WorldObjectChangeAccumulator::BuildPacket(Player* plr)
-{
- // Only send update once to a player
- if (plr_list.find(plr->GetGUID()) == plr_list.end() && plr->HaveAtClient(&i_object))
- {
- ObjectAccessor::_buildPacket(plr, &i_object, i_updateDatas);
- plr_list.insert(plr->GetGUID());
- }
-}
-
-void
-ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
-{
- CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- Cell cell(p);
-
- obj->GetMap()->UpdateObjectVisibility(obj, cell, p);
-}
/*void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
{