mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
fix(Core/Combat): Creatures should evade if its only victim is teleporting to other map (#7975)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "CreatureAI.h"
|
||||
#include "HostileRefMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
@@ -99,13 +100,28 @@ void HostileRefMgr::updateThreatTables()
|
||||
// The references are not needed anymore
|
||||
// tell the source to remove them from the list and free the mem
|
||||
|
||||
void HostileRefMgr::deleteReferences()
|
||||
void HostileRefMgr::deleteReferences(bool removeFromMap /*= false*/)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
{
|
||||
HostileReference* nextRef = ref->next();
|
||||
ref->removeReference();
|
||||
|
||||
if (removeFromMap)
|
||||
{
|
||||
if (ThreatMgr const* threatMgr = ref->GetSource())
|
||||
{
|
||||
if (threatMgr->areThreatListsEmpty())
|
||||
{
|
||||
if (Creature* creature = threatMgr->GetOwner()->ToCreature())
|
||||
{
|
||||
creature->AI()->EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete ref;
|
||||
ref = nextRef;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user