Core/Unit: Move code using polymorphism out of CharmInfo destructor - fixes issues introduced with 38ea569525.
This commit is contained in:
@@ -206,7 +206,7 @@ Unit::~Unit()
|
|||||||
|
|
||||||
_DeleteRemovedAuras();
|
_DeleteRemovedAuras();
|
||||||
|
|
||||||
ASSERT(!m_charmInfo);
|
delete m_charmInfo;
|
||||||
delete m_vehicleKit;
|
delete m_vehicleKit;
|
||||||
|
|
||||||
ASSERT(!m_duringRemoveFromWorld);
|
ASSERT(!m_duringRemoveFromWorld);
|
||||||
@@ -13360,8 +13360,6 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup)
|
|||||||
if (Creature* thisCreature = ToCreature())
|
if (Creature* thisCreature = ToCreature())
|
||||||
if (GetTransport())
|
if (GetTransport())
|
||||||
GetTransport()->RemovePassenger(thisCreature);
|
GetTransport()->RemovePassenger(thisCreature);
|
||||||
|
|
||||||
DeleteCharmInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::UpdateCharmAI()
|
void Unit::UpdateCharmAI()
|
||||||
@@ -13404,6 +13402,7 @@ void Unit::DeleteCharmInfo()
|
|||||||
if (!m_charmInfo)
|
if (!m_charmInfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_charmInfo->RestoreState();
|
||||||
delete m_charmInfo;
|
delete m_charmInfo;
|
||||||
m_charmInfo = NULL;
|
m_charmInfo = NULL;
|
||||||
}
|
}
|
||||||
@@ -13423,6 +13422,10 @@ CharmInfo::CharmInfo(Unit* unit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharmInfo::~CharmInfo()
|
CharmInfo::~CharmInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharmInfo::RestoreState()
|
||||||
{
|
{
|
||||||
if (m_unit->GetTypeId() == TYPEID_UNIT)
|
if (m_unit->GetTypeId() == TYPEID_UNIT)
|
||||||
if (Creature *pCreature = m_unit->ToCreature())
|
if (Creature *pCreature = m_unit->ToCreature())
|
||||||
|
|||||||
@@ -1027,6 +1027,7 @@ struct CharmInfo
|
|||||||
public:
|
public:
|
||||||
explicit CharmInfo(Unit* unit);
|
explicit CharmInfo(Unit* unit);
|
||||||
~CharmInfo();
|
~CharmInfo();
|
||||||
|
void RestoreState();
|
||||||
uint32 GetPetNumber() const { return m_petnumber; }
|
uint32 GetPetNumber() const { return m_petnumber; }
|
||||||
void SetPetNumber(uint32 petnumber, bool statwindow);
|
void SetPetNumber(uint32 petnumber, bool statwindow);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user