aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Maps/Map.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index bd419482b5b..d5be15ee012 100755
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -426,6 +426,10 @@ void Map::AddToMap(T *obj)
}
CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
+ //It will create many problems (including crashes) if an object is not added to grid after creation
+ //The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
+ //But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
+ ASSERT(cellCoord.IsCoordValid());
if (!cellCoord.IsCoordValid())
{
sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);