aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-18 11:03:27 -0500
committermegamage <none@none>2009-04-18 11:03:27 -0500
commit60736b1f7da05e5eee5100edc3e80fbb9e228495 (patch)
tree24e077c981586c2939a8de704fe58c7604a3f8af /src
parent9bb3356504a411a6f60243666f89832626561c14 (diff)
*Fix visibility update bug of long-distance teleport.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Map.cpp14
-rw-r--r--src/game/Unit.h3
2 files changed, 15 insertions, 2 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index b12c7b477c0..8a673c8937d 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -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());
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 795d2982c07..f63ce4c4f23 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1416,8 +1416,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void AddPetAura(PetAura const* petSpell);
void RemovePetAura(PetAura const* petSpell);
+ // relocation notification
void SetToNotify();
bool m_Notified, m_IsInNotifyList;
+ float oldX, oldY;
+
void SetReducedThreatPercent(uint32 pct, uint64 guid)
{
m_reducedThreatPercent = pct;