From bdafaf41134a26818d81ad1ffe853f6013635c4c Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 26 Mar 2009 10:53:19 -0600 Subject: *Remove viewpoint when dynamicobject is removed from world. --HG-- branch : trunk --- src/game/DynamicObject.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/game/DynamicObject.cpp') diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 3ac8b688e8b..72c1f4b2ce2 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -53,6 +53,18 @@ void DynamicObject::RemoveFromWorld() ///- Remove the dynamicObject from the accessor if(IsInWorld()) { + if(m_effIndex == 4) + { + if(Unit *caster = GetCaster()) + { + if(caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)caster)->SetViewpoint(this, false); + } + else + { + sLog.outCrash("DynamicObject::RemoveFromWorld cannot find viewpoint owner"); + } + } ObjectAccessor::Instance().RemoveObject(this); WorldObject::RemoveFromWorld(); } @@ -134,6 +146,7 @@ void DynamicObject::Update(uint32 p_time) void DynamicObject::Delete() { SendObjectDeSpawnAnim(GetGUID()); + RemoveFromWorld(); AddObjectToRemoveList(); } -- cgit v1.2.3