[11206] Move visibility self/around to new function and use it.

* Fixed wrong visibility changes in some cases at .mod phase uses.
* Apply phase change to any owned units (not only pets as before).
  It also will applied in more safe way for avoid unexpected lost owner at update.
* Check view point setting auras targets accessability not only at visibility change
  but also at phase change.
* Replace SetVisibility(GetVisibility()) hack like calls.
This commit is contained in:
VladimirMangos 2011-02-27 19:16:31 +03:00
parent bef47ce126
commit f1899e3b27
6 changed files with 64 additions and 50 deletions

View file

@ -1912,10 +1912,7 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
m_phaseMask = newPhaseMask;
if(update && IsInWorld())
{
UpdateObjectVisibility();
GetViewPoint().Event_ViewPointVisibilityChanged();
}
UpdateVisibilityAndView();
}
void WorldObject::PlayDistanceSound( uint32 sound_id, Player* target /*= NULL*/ )
@ -1939,6 +1936,13 @@ void WorldObject::PlayDirectSound( uint32 sound_id, Player* target /*= NULL*/ )
SendMessageToSet( &data, true );
}
void WorldObject::UpdateVisibilityAndView()
{
GetViewPoint().Call_UpdateVisibilityForOwner();
UpdateObjectVisibility();
GetViewPoint().Event_ViewPointVisibilityChanged();
}
void WorldObject::UpdateObjectVisibility()
{
CellPair p = MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY());