diff options
author | megamage <none@none> | 2009-02-17 21:50:18 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-17 21:50:18 -0600 |
commit | be53cfe1044d7e913c4c11a7245e2d2846826363 (patch) | |
tree | 01d9eed43ebf99bd2829827fdc9d966c4992fd3b /src/game/DynamicObject.cpp | |
parent | d11c80ec54bff97235440ff50c44edd420e777f9 (diff) |
*Fix some bugs of map/grid. Hope this can fix some crashes (without introducing new crash)
--HG--
branch : trunk
Diffstat (limited to 'src/game/DynamicObject.cpp')
-rw-r--r-- | src/game/DynamicObject.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 4f63a149244..d9e46e2b52e 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -52,6 +52,13 @@ void DynamicObject::AddToWorld() void DynamicObject::RemoveFromWorld() { + // Make sure the object is back to grid container for removal as farsight targets + // are switched to world container on creation and they are also set to active + if (isActive()) + { + GetMap()->SwitchGridContainers(this, false); + setActive(false); + } ///- Remove the dynamicObject from the accessor if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this); WorldObject::RemoveFromWorld(); @@ -129,19 +136,6 @@ void DynamicObject::Update(uint32 p_time) void DynamicObject::Delete() { - // Make sure the object is back to grid container for removal as farsight targets - // are switched to world container on creation and they are also set to active - if (isActive()) - { - Map* map = GetMap(); - if(!map) - { - sLog.outError("DynamicObject (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId()); - return; - } - map->SwitchGridContainers(this, false); - setActive(false); - } SendObjectDeSpawnAnim(GetGUID()); AddObjectToRemoveList(); } |