diff options
author | megamage <none@none> | 2009-05-03 10:45:34 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-03 10:45:34 -0500 |
commit | f6e8ccb239eaaa98bceab708a831e163d4107a3c (patch) | |
tree | 489ed002538bd17ea047d43d8dd38acc5bb082ab /src/game/Totem.cpp | |
parent | f9b13b45e09e06ce2400c5e93a97ac2459d7159c (diff) |
*Clean up summon code.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Totem.cpp')
-rw-r--r-- | src/game/Totem.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 5f1a044d4df..af36c43a999 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -110,35 +110,32 @@ void Totem::UnSummon() CombatStop(); RemoveAurasDueToSpell(GetSpell()); - Unit *owner = GetOwner(); - if (owner) + + // clear owenr's totem slot + for(int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { - // clear owenr's totem slot - for(int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) + if(m_owner->m_SummonSlot[i]==GetGUID()) { - if(owner->m_SummonSlot[i]==GetGUID()) - { - owner->m_SummonSlot[i] = 0; - break; - } + m_owner->m_SummonSlot[i] = 0; + break; } + } - owner->RemoveAurasDueToSpell(GetSpell()); + m_owner->RemoveAurasDueToSpell(GetSpell()); - //remove aura all party members too - Group *pGroup = NULL; - if (owner->GetTypeId() == TYPEID_PLAYER) + //remove aura all party members too + Group *pGroup = NULL; + if (m_owner->GetTypeId() == TYPEID_PLAYER) + { + // Not only the player can summon the totem (scripted AI) + pGroup = ((Player*)m_owner)->GetGroup(); + if (pGroup) { - // Not only the player can summon the totem (scripted AI) - pGroup = ((Player*)owner)->GetGroup(); - if (pGroup) + for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* Target = itr->getSource(); - if(Target && pGroup->SameSubGroup((Player*)owner, Target)) - Target->RemoveAurasDueToSpell(GetSpell()); - } + Player* Target = itr->getSource(); + if(Target && pGroup->SameSubGroup((Player*)m_owner, Target)) + Target->RemoveAurasDueToSpell(GetSpell()); } } } |