fix(Core/Crash): Evade after cleaning threat references. (#8160)
This commit is contained in:
parent
702573038e
commit
0d411ec2c3
2 changed files with 9 additions and 2 deletions
|
|
@ -113,6 +113,8 @@ void HostileRefMgr::updateThreatTables()
|
|||
|
||||
void HostileRefMgr::deleteReferences(bool removeFromMap /*= false*/)
|
||||
{
|
||||
std::vector<Creature*> creaturesToEvade;
|
||||
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
{
|
||||
|
|
@ -127,7 +129,7 @@ void HostileRefMgr::deleteReferences(bool removeFromMap /*= false*/)
|
|||
{
|
||||
if (Creature* creature = threatMgr->GetOwner()->ToCreature())
|
||||
{
|
||||
creature->AI()->EnterEvadeMode();
|
||||
creaturesToEvade.push_back(creature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,6 +138,11 @@ void HostileRefMgr::deleteReferences(bool removeFromMap /*= false*/)
|
|||
delete ref;
|
||||
ref = nextRef;
|
||||
}
|
||||
|
||||
for (Creature* creature : creaturesToEvade)
|
||||
{
|
||||
creature->AI()->EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================
|
||||
|
|
|
|||
|
|
@ -14812,7 +14812,7 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
|
|||
CombatStop();
|
||||
ClearComboPointHolders();
|
||||
DeleteThreatList();
|
||||
getHostileRefMgr().deleteReferences(true);
|
||||
getHostileRefMgr().deleteReferences();
|
||||
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue