Core/Maps: Adjusted WorldObject::GetGridActivationRange() to never be less than map visibility distance for active objects to ensure equal ranges for activation/deactivation of grids

Updates #19072
This commit is contained in:
Shauren
2017-02-08 20:23:37 +01:00
committed by Aokromes
parent 159709e0b0
commit 9d4a1ddc10
2 changed files with 11 additions and 21 deletions

View File

@@ -1692,23 +1692,18 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
float WorldObject::GetGridActivationRange() const
{
if (ToPlayer())
if (isActiveObject())
{
if (ToPlayer()->GetCinematicMgr()->IsOnCinematic())
return DEFAULT_VISIBILITY_INSTANCE;
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetCinematicMgr->IsOnCinematic())
return std::max(DEFAULT_VISIBILITY_INSTANCE, GetMap()->GetVisibilityRange());
return GetMap()->GetVisibilityRange();
}
else if (ToCreature())
return ToCreature()->m_SightDistance;
else if (ToDynObject())
{
if (isActiveObject())
return GetMap()->GetVisibilityRange();
else
return 0.0f;
}
else
return 0.0f;
if (Creature const* thisCreature = ToCreature())
return thisCreature->m_SightDistance;
return 0.0f;
}
float WorldObject::GetVisibilityRange() const

View File

@@ -716,14 +716,9 @@ void Map::Update(const uint32 t_diff)
VisitNearbyCellsOf(player, grid_object_update, world_object_update);
// If player is using far sight, visit that object too
// If player is using far sight or mind vision, visit that object too
if (WorldObject* viewPoint = player->GetViewpoint())
{
if (Creature* viewCreature = viewPoint->ToCreature())
VisitNearbyCellsOf(viewCreature, grid_object_update, world_object_update);
else if (DynamicObject* viewObject = viewPoint->ToDynObject())
VisitNearbyCellsOf(viewObject, grid_object_update, world_object_update);
}
VisitNearbyCellsOf(viewPoint, grid_object_update, world_object_update);
// Handle updates for creatures in combat with player and are more than 60 yards away
if (player->IsInCombat())