fix(Core): Crashfix. (#11903)

* fix(Core): Crashfix.

Fixes #11650

* Update.
This commit is contained in:
UltraNix
2022-06-26 09:50:22 +02:00
committed by GitHub
parent e258a96e38
commit 255c5d8b72
3 changed files with 30 additions and 11 deletions

View File

@@ -18612,23 +18612,38 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
}
}
WorldObject::SetPhaseMask(newPhaseMask, update);
WorldObject::SetPhaseMask(newPhaseMask, false);
if (!IsInWorld())
{
return;
}
for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); )
{
Unit* controlled = *itr;
++itr;
if (controlled->GetTypeId() == TYPEID_UNIT)
{
controlled->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);
}
}
}
if (update)
{
UpdateObjectVisibility();
}
}
void Unit::UpdateObjectVisibility(bool forced, bool /*fromUpdate*/)