mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
*Fix visibility update bug of long-distance teleport.
--HG-- branch : trunk
This commit is contained in:
@@ -645,16 +645,24 @@ void Map::RelocationNotify()
|
||||
unit->m_Notified = true;
|
||||
unit->m_IsInNotifyList = false;
|
||||
|
||||
float dist = abs(unit->GetPositionX() - unit->oldX) + abs(unit->GetPositionY() - unit->oldY);
|
||||
if(dist > 10.0f)
|
||||
{
|
||||
Trinity::VisibleChangesNotifier notifier(*unit);
|
||||
VisitWorld(unit->oldX, unit->oldY, World::GetMaxVisibleDistance(), notifier);
|
||||
dist = 0;
|
||||
}
|
||||
|
||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
|
||||
notifier.Notify();
|
||||
}
|
||||
else
|
||||
{
|
||||
Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit));
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
|
||||
}
|
||||
}
|
||||
for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||
@@ -670,6 +678,8 @@ void Map::AddUnitToNotify(Unit* u)
|
||||
return;
|
||||
|
||||
u->m_IsInNotifyList = true;
|
||||
u->oldX = u->GetPositionX();
|
||||
u->oldY = u->GetPositionY();
|
||||
|
||||
if(i_lock)
|
||||
i_unitsToNotifyBacklog.push_back(u->GetGUID());
|
||||
|
||||
Reference in New Issue
Block a user