diff options
author | megamage <none@none> | 2009-03-27 22:47:28 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-27 22:47:28 -0600 |
commit | ff83e4a9b13594be4a682da535c9522c9f9de186 (patch) | |
tree | b948e5d4508f23b9c99335d4a92475d9d1f6aea1 /src/game/TemporarySummon.cpp | |
parent | d0a58f705f34a6831a242977b0059a03dba8b5a6 (diff) |
*Fix some bugs of pet.
--HG--
branch : trunk
Diffstat (limited to 'src/game/TemporarySummon.cpp')
-rw-r--r-- | src/game/TemporarySummon.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 06dfea5a25a..fde2f4d7d84 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -182,16 +182,15 @@ void TempSummon::InitSummon(uint32 duration) Unit* owner = GetSummoner(); if(uint32 slot = m_Properties->Slot) { - --slot; if(owner) { - if(owner->m_TotemSlot[slot] && owner->m_TotemSlot[slot] != GetGUID()) + if(owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID()) { - Creature *OldTotem = ObjectAccessor::GetCreature(*this, owner->m_TotemSlot[slot]); + Creature *OldTotem = ObjectAccessor::GetCreature(*this, owner->m_SummonSlot[slot]); if(OldTotem && OldTotem->isSummon()) ((TempSummon*)OldTotem)->UnSummon(); } - owner->m_TotemSlot[slot] = GetGUID(); + owner->m_SummonSlot[slot] = GetGUID(); } } @@ -206,6 +205,8 @@ void TempSummon::SetTempSummonType(TempSummonType type) void TempSummon::UnSummon() { + assert(!isPet()); + Unit* owner = GetSummoner(); if(owner && owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled) ((Creature*)owner)->AI()->SummonedCreatureDespawn(this); @@ -225,12 +226,15 @@ void TempSummon::RemoveFromWorld() { if(Unit* owner = GetSummoner()) { - --slot; - if(owner->m_TotemSlot[slot] = GetGUID()) - owner->m_TotemSlot[slot] = 0; + if(owner->m_SummonSlot[slot] = GetGUID()) + owner->m_SummonSlot[slot] = 0; } } } + + if(GetOwnerGUID()) + sLog.outError("Unit %u has owner guid when removed from world", GetEntry()); + Creature::RemoveFromWorld(); } @@ -253,13 +257,14 @@ void Guardian::InitSummon(uint32 duration) SetCreatorGUID(m_owner->GetGUID()); setFaction(m_owner->getFaction()); - m_owner->SetPet(this, true); if(m_owner->GetTypeId() == TYPEID_PLAYER) { m_charmInfo->InitCharmCreateSpells(); - ((Player*)m_owner)->CharmSpellInitialize(); + //((Player*)m_owner)->CharmSpellInitialize(); } + + m_owner->SetGuardian(this, true); } void Guardian::RemoveFromWorld() @@ -267,7 +272,7 @@ void Guardian::RemoveFromWorld() if(!IsInWorld()) return; - m_owner->SetPet(this, false); + m_owner->SetGuardian(this, false); TempSummon::RemoveFromWorld(); } |