aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none.none>2011-11-28 11:32:52 -0500
committermegamage <none@none.none>2011-11-28 11:32:52 -0500
commit49b24070771493625fe3ada260b3ecf0aa2581ad (patch)
tree25611699b6131a8141596d99426784b4b9f87ef8 /src
parent0b4b853a0530be6c2557dbc9f46ab61c0767f0cc (diff)
Add an ASSERT to find out the reasons of some crashes.
Diffstat (limited to 'src')
-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);