diff options
-rw-r--r-- | src/game/Map.cpp | 8 | ||||
-rw-r--r-- | src/game/Map.h | 2 | ||||
-rw-r--r-- | src/game/Unit.cpp | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 85a720948ab..47925102892 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -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 { diff --git a/src/game/Map.h b/src/game/Map.h index bfd8d178fdd..68d5b90f48d 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -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; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index d126255047c..0de06b9e9a9 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12366,7 +12366,7 @@ void Unit::RemoveFromWorld() if(m_NotifyListPos >= 0) { - GetMap()->RemoveUnitFromNotify(m_NotifyListPos); + GetMap()->RemoveUnitFromNotify(this, m_NotifyListPos); m_NotifyListPos = -1; } |