Move visibility update functions to more appropriate classes.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
XTZGZoReX 2009-10-01 18:58:08 +04:00 committed by VladimirMangos
parent 4041121fd8
commit 63897d56d7
10 changed files with 47 additions and 44 deletions

View file

@ -442,36 +442,6 @@ ObjectAccessor::WorldObjectChangeAccumulator::Visit(PlayerMapType &m)
ObjectAccessor::_buildPacket(iter->getSource(), &i_object, i_updateDatas);
}
void
ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)
{
CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
Cell cell(p);
obj->GetMap()->UpdateObjectVisibility(obj, cell, p);
}
void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
{
WorldObject const* viewPoint = player->GetViewPoint();
Map* m = player->GetMap();
CellPair p(MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()));
Cell cell(p);
m->UpdatePlayerVisibility(player, cell, p);
if (player!=viewPoint)
{
CellPair pView(MaNGOS::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY()));
Cell cellView(pView);
m->UpdateObjectsVisibilityFor(player, cellView, pView);
}
else
m->UpdateObjectsVisibilityFor(player, cell, p);
}
/// Define the static member of HashMapHolder
template <class T> UNORDERED_MAP< uint64, T* > HashMapHolder<T>::m_objectMap;