aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-08 17:47:23 -0500
committermegamage <none@none>2009-08-08 17:47:23 -0500
commita78a0c6b0175aeec85ed3a53ddb52dcf5eeebdcf (patch)
treec46b83a98a3ef51755b71b68a80a61e144f0d0b6
parent64ee35bd94d70872d404c23094f96962fe8f6114 (diff)
*Fix a crash caused by relocationnotify
--HG-- branch : trunk
-rw-r--r--src/game/Map.cpp8
-rw-r--r--src/game/Map.h2
-rw-r--r--src/game/Unit.cpp2
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;
}