*Fix a crash caused by relocationnotify

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-08 17:47:23 -05:00
parent 64ee35bd94
commit a78a0c6b01
3 changed files with 7 additions and 5 deletions

View File

@@ -649,12 +649,14 @@ void Map::AddUnitToNotify(Unit* u)
}
}
void Map::RemoveUnitFromNotify(int32 slot)
void Map::RemoveUnitFromNotify(Unit *unit, int32 slot)
{
if(i_lock)
{
assert(slot < i_unitsToNotifyBacklog.size());
i_unitsToNotifyBacklog[slot] = NULL;
if(slot < i_unitsToNotifyBacklog.size() && i_unitsToNotifyBacklog[slot] == unit)
i_unitsToNotifyBacklog[slot] = NULL;
else if(slot < i_unitsToNotify.size() && i_unitsToNotify[slot] == unit)
i_unitsToNotify[slot] = NULL;
}
else
{

View File

@@ -404,7 +404,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
bool ActiveObjectsNearGrid(uint32 x, uint32 y) const;
void AddUnitToNotify(Unit* unit);
void RemoveUnitFromNotify(int32 slot);
void RemoveUnitFromNotify(Unit *unit, int32 slot);
void SendToPlayers(WorldPacket const* data) const;

View File

@@ -12366,7 +12366,7 @@ void Unit::RemoveFromWorld()
if(m_NotifyListPos >= 0)
{
GetMap()->RemoveUnitFromNotify(m_NotifyListPos);
GetMap()->RemoveUnitFromNotify(this, m_NotifyListPos);
m_NotifyListPos = -1;
}