Clean up summon/remove gameobject code.

This commit is contained in:
megamage
2011-10-31 10:46:39 -04:00
parent dfeb4a746b
commit 1b8d9ec7b4
4 changed files with 37 additions and 41 deletions
+6 -4
View File
@@ -181,7 +181,8 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this)
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
m_SummonSlot[i] = 0;
m_ObjectSlot[0] = m_ObjectSlot[1] = m_ObjectSlot[2] = m_ObjectSlot[3] = 0;
for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
m_ObjectSlot[i] = 0;
m_auraUpdateIterator = m_ownedAuras.end();
@@ -4661,7 +4662,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del)
gameObj->SetOwnerGUID(0);
for (uint32 i = 0; i < 4; ++i)
for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
{
if (m_ObjectSlot[i] == gameObj->GetGUID())
{
@@ -4721,12 +4722,13 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
void Unit::RemoveAllGameObjects()
{
// remove references to unit
for (GameObjectList::iterator i = m_gameObj.begin(); i != m_gameObj.end();)
while (!m_gameObj.empty())
{
GameObjectList::iterator i = m_gameObj.begin();
(*i)->SetOwnerGUID(0);
(*i)->SetRespawnTime(0);
(*i)->Delete();
i = m_gameObj.erase(i);
m_gameObj.erase(i);
}
}
+3 -1
View File
@@ -1208,6 +1208,8 @@ enum ReactiveType
#define SUMMON_SLOT_QUEST 6
#define MAX_SUMMON_SLOT 7
#define MAX_GAMEOBJECT_SLOT 4
enum PlayerTotemType
{
SUMMON_TYPE_TOTEM_FIRE = 63,
@@ -1891,7 +1893,7 @@ class Unit : public WorldObject
uint32 m_addDmgOnce;
uint64 m_SummonSlot[MAX_SUMMON_SLOT];
uint64 m_ObjectSlot[4];
uint64 m_ObjectSlot[MAX_GAMEOBJECT_SLOT];
ShapeshiftForm GetShapeshiftForm() const { return ShapeshiftForm(GetByteValue(UNIT_FIELD_BYTES_2, 3)); }
void SetShapeshiftForm(ShapeshiftForm form)