aboutsummaryrefslogtreecommitdiff
path: root/src/game/TemporarySummon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/TemporarySummon.cpp')
-rw-r--r--src/game/TemporarySummon.cpp25
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();
}