Core: Fix pet dismiss on phase with update

This commit is contained in:
Rochet2 committed 2014-06-21 23:57:23 +03:00
1 parent dae3ae0696
commit c22d51f468
1 file changed
+16 -10
+16 -10
View File
@@ -16378,19 +16378,25 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
}
}
WorldObject::SetPhaseMask(newPhaseMask, update);
// Phase player, dont update
WorldObject::SetPhaseMask(newPhaseMask, false);
if (!IsInWorld())
return;
// Phase pets and summons
if (IsInWorld())
{
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
if ((*itr)->GetTypeId() == TYPEID_UNIT)
(*itr)->SetPhaseMask(newPhaseMask, true);
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
if ((*itr)->GetTypeId() == TYPEID_UNIT)
(*itr)->SetPhaseMask(newPhaseMask, true);
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
if (m_SummonSlot[i])
if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
summon->SetPhaseMask(newPhaseMask, true);
}
for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
if (m_SummonSlot[i])
if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
summon->SetPhaseMask(newPhaseMask, true);
// Update visibility after phasing pets and summons so they wont despawn
if (update)
UpdateObjectVisibility();
}
void Unit::UpdateObjectVisibility(bool forced)