mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
fix(Core/Crash): Evade after cleaning threat references. (#8160)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================
|
||||
|
||||
Reference in New Issue
Block a user