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

@ -2229,7 +2229,7 @@ void Player::SetGameMaster(bool on)
getHostilRefManager().setOnlineOfflineState(true);
}
ObjectAccessor::UpdateVisibilityForPlayer(this);
UpdateVisibilityForPlayer();
}
void Player::SetGMVisible(bool on)
@ -4142,7 +4142,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
UpdateZone(newzone,newarea);
// update visibility
ObjectAccessor::UpdateVisibilityForPlayer(this);
UpdateVisibilityForPlayer();
if(!applySickness)
return;
@ -4195,7 +4195,7 @@ void Player::KillPlayer()
// don't create corpse at this moment, player might be falling
// update visibility
ObjectAccessor::UpdateObjectVisibility(this);
UpdateObjectVisibility();
}
void Player::CreateCorpse()
@ -20616,5 +20616,27 @@ void Player::SetFarSightGUID( uint64 guid )
SetUInt64Value(PLAYER_FARSIGHT, guid);
// need triggering load grids around new view point
ObjectAccessor::UpdateVisibilityForPlayer(this);
UpdateVisibilityForPlayer();
}
void Player::UpdateVisibilityForPlayer()
{
WorldObject const* viewPoint = GetViewPoint();
Map* m = GetMap();
CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));
Cell cell(p);
m->UpdatePlayerVisibility(this, cell, p);
if (this != viewPoint)
{
CellPair pView(MaNGOS::ComputeCellPair(viewPoint->GetPositionX(), viewPoint->GetPositionY()));
Cell cellView(pView);
m->UpdateObjectsVisibilityFor(this, cellView, pView);
}
else
m->UpdateObjectsVisibilityFor(this, cell, p);
}