aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQAston <qaston@gmail.com>2011-02-04 01:23:49 +0100
committerQAston <qaston@gmail.com>2011-02-04 01:23:49 +0100
commit38ea56952594eeac678ab9f3c85e00cbbfb0d4d0 (patch)
tree2314b41a9fda4148f7e336c8b690a1cf43aaa166
parentd18193e52dd0799927ac925158300ef4e5c88ba8 (diff)
Core/Unit: Remove code which depends on polymorphism from Unit class destructor (at destruction time virtual methods aren't working as excpected)
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ceff4094855..9e76e5f2def 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -204,11 +204,9 @@ Unit::~Unit()
}
}
- RemoveAllGameObjects();
- RemoveAllDynObjects();
_DeleteRemovedAuras();
- delete m_charmInfo;
+ ASSERT(!m_charmInfo);
delete m_vehicleKit;
ASSERT(!m_duringRemoveFromWorld);
@@ -219,6 +217,8 @@ Unit::~Unit()
ASSERT(m_appliedAuras.empty());
ASSERT(m_ownedAuras.empty());
ASSERT(m_removedAuras.empty());
+ ASSERT(m_gameObj.empty());
+ ASSERT(m_dynObj.empty());
}
void Unit::Update(uint32 p_time)
@@ -13345,6 +13345,7 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
//A unit may be in removelist and not in world, but it is still in grid
//and may have some references during delete
RemoveAllAuras();
+ RemoveAllGameObjects();
if (finalCleanup)
m_cleanupDone = true;
@@ -13359,6 +13360,8 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
if (Creature* thisCreature = ToCreature())
if (GetTransport())
GetTransport()->RemovePassenger(thisCreature);
+
+ DeleteCharmInfo();
}
void Unit::UpdateCharmAI()
@@ -13417,7 +13420,6 @@ CharmInfo::CharmInfo(Unit* unit)
m_oldReactState = m_unit->ToCreature()->GetReactState();
m_unit->ToCreature()->SetReactState(REACT_PASSIVE);
}
-
}
CharmInfo::~CharmInfo()