*Fix visibility update bug of long-distance teleport.
--HG-- branch : trunk
This commit is contained in:
+12
-2
@@ -645,16 +645,24 @@ void Map::RelocationNotify()
|
|||||||
unit->m_Notified = true;
|
unit->m_Notified = true;
|
||||||
unit->m_IsInNotifyList = false;
|
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)
|
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
||||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
|
||||||
notifier.Notify();
|
notifier.Notify();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit));
|
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)
|
for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||||
@@ -670,6 +678,8 @@ void Map::AddUnitToNotify(Unit* u)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
u->m_IsInNotifyList = true;
|
u->m_IsInNotifyList = true;
|
||||||
|
u->oldX = u->GetPositionX();
|
||||||
|
u->oldY = u->GetPositionY();
|
||||||
|
|
||||||
if(i_lock)
|
if(i_lock)
|
||||||
i_unitsToNotifyBacklog.push_back(u->GetGUID());
|
i_unitsToNotifyBacklog.push_back(u->GetGUID());
|
||||||
|
|||||||
@@ -1416,8 +1416,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void AddPetAura(PetAura const* petSpell);
|
void AddPetAura(PetAura const* petSpell);
|
||||||
void RemovePetAura(PetAura const* petSpell);
|
void RemovePetAura(PetAura const* petSpell);
|
||||||
|
|
||||||
|
// relocation notification
|
||||||
void SetToNotify();
|
void SetToNotify();
|
||||||
bool m_Notified, m_IsInNotifyList;
|
bool m_Notified, m_IsInNotifyList;
|
||||||
|
float oldX, oldY;
|
||||||
|
|
||||||
void SetReducedThreatPercent(uint32 pct, uint64 guid)
|
void SetReducedThreatPercent(uint32 pct, uint64 guid)
|
||||||
{
|
{
|
||||||
m_reducedThreatPercent = pct;
|
m_reducedThreatPercent = pct;
|
||||||
|
|||||||
Reference in New Issue
Block a user