aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Map.cpp27
-rw-r--r--src/game/Map.h2
2 files changed, 17 insertions, 12 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 5f98cffde2b..c807c6ab1a1 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -642,22 +642,27 @@ bool Map::loaded(const GridPair &p) const
void Map::Update(const uint32 &t_diff)
{
- for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
+ for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
{
- (*iter)->m_Notified = true;
- if(!(*iter)->IsInWorld())
+ Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL);
+ if(!unit) continue;
+ unit->m_Notified = true;
+ if(!unit->IsInWorld())
continue;
- CellPair val = Trinity::ComputeCellPair((*iter)->GetPositionX(), (*iter)->GetPositionY());
+ CellPair val = Trinity::ComputeCellPair(unit->GetPositionX(), unit->GetPositionY());
Cell cell(val);
- if((*iter)->GetTypeId() == TYPEID_PLAYER)
- PlayerRelocationNotify((Player*)(*iter), cell, val);
+ if(unit->GetTypeId() == TYPEID_PLAYER)
+ PlayerRelocationNotify((Player*)unit, cell, val);
else
- CreatureRelocationNotify((Creature*)(*iter), cell, val);
+ CreatureRelocationNotify((Creature*)unit, cell, val);
}
- for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
+ for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
{
- (*iter)->m_IsInNotifyList = false;
- (*iter)->m_Notified = false;
+ if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
+ {
+ unit->m_IsInNotifyList = false;
+ unit->m_Notified = false;
+ }
}
i_unitsToNotify.clear();
@@ -2055,7 +2060,7 @@ void Map::AddUnitToNotify(Unit* u)
{
if(!u->m_IsInNotifyList)
{
- i_unitsToNotify.push_back(u);
+ i_unitsToNotify.push_back(u->GetGUID());
u->m_IsInNotifyList = true;
}
} \ No newline at end of file
diff --git a/src/game/Map.h b/src/game/Map.h
index 554b43217e1..167a34dcccd 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -315,7 +315,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
time_t i_gridExpiry;
std::set<WorldObject *> i_activeObjects;
- std::vector<Unit*> i_unitsToNotify;
+ std::vector<uint64> i_unitsToNotify;
std::set<WorldObject *> i_objectsToRemove;
// Type specific code for add/remove to/from grid