*Fix crash bug in 353. Please do not use 353!

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-29 23:07:23 -06:00
parent 7af8633331
commit 375d3ba4eb
2 changed files with 17 additions and 12 deletions
+16 -11
View File
@@ -642,22 +642,27 @@ bool Map::loaded(const GridPair &p) const
void Map::Update(const uint32 &t_diff) 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; Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL);
if(!(*iter)->IsInWorld()) if(!unit) continue;
unit->m_Notified = true;
if(!unit->IsInWorld())
continue; continue;
CellPair val = Trinity::ComputeCellPair((*iter)->GetPositionX(), (*iter)->GetPositionY()); CellPair val = Trinity::ComputeCellPair(unit->GetPositionX(), unit->GetPositionY());
Cell cell(val); Cell cell(val);
if((*iter)->GetTypeId() == TYPEID_PLAYER) if(unit->GetTypeId() == TYPEID_PLAYER)
PlayerRelocationNotify((Player*)(*iter), cell, val); PlayerRelocationNotify((Player*)unit, cell, val);
else 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; if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
(*iter)->m_Notified = false; {
unit->m_IsInNotifyList = false;
unit->m_Notified = false;
}
} }
i_unitsToNotify.clear(); i_unitsToNotify.clear();
@@ -2055,7 +2060,7 @@ void Map::AddUnitToNotify(Unit* u)
{ {
if(!u->m_IsInNotifyList) if(!u->m_IsInNotifyList)
{ {
i_unitsToNotify.push_back(u); i_unitsToNotify.push_back(u->GetGUID());
u->m_IsInNotifyList = true; u->m_IsInNotifyList = true;
} }
} }
+1 -1
View File
@@ -315,7 +315,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
time_t i_gridExpiry; time_t i_gridExpiry;
std::set<WorldObject *> i_activeObjects; std::set<WorldObject *> i_activeObjects;
std::vector<Unit*> i_unitsToNotify; std::vector<uint64> i_unitsToNotify;
std::set<WorldObject *> i_objectsToRemove; std::set<WorldObject *> i_objectsToRemove;
// Type specific code for add/remove to/from grid // Type specific code for add/remove to/from grid