aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authorAstellar <none@none>2010-01-05 02:42:40 +0300
committerAstellar <none@none>2010-01-05 02:42:40 +0300
commita4895ce87678280718ae2e8dc701bb526ca049ab (patch)
treeab19f21369f61a1fd5948b61ddfa36e8c1d0d295 /src/game/Unit.cpp
parent51d0e0fa8cc47e8d675259ec485fa2b62fa77041 (diff)
Fixed previous commit. Now elemental is despawned when totem is replaced.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b4a1efa9c45..0e0416e5b01 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -9039,8 +9039,22 @@ void Unit::SetMinion(Minion *minion, bool apply)
m_Controlled.erase(minion);
if (minion->IsGuardianPet())
+ {
if (GetPetGUID() == minion->GetGUID())
SetPetGUID(0);
+ }
+ else if (minion->isTotem())
+ {
+ // All summoned by totem minions must disappear when it is removed.
+ if (const SpellEntry* spInfo = sSpellStore.LookupEntry(((Totem*)minion)->GetSpell()))
+ for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ {
+ if (spInfo->Effect[i] != SPELL_EFFECT_SUMMON)
+ continue;
+
+ this->RemoveAllMinionsByEntry(spInfo->EffectMiscValue[i]);
+ }
+ }
if (GetTypeId() == TYPEID_PLAYER)
{