Fix ClearAggro xtarget issue

This commit is contained in:
Michael Cook (mackal) 2017-03-02 14:31:48 -05:00
parent 2ab280bef0
commit 7d13475bac

View File

@ -2980,10 +2980,16 @@ void EntityList::Evade(Mob *who)
//removes "targ" from all hate lists, including feigned, in the zone
void EntityList::ClearAggro(Mob* targ)
{
Client *c = nullptr;
if (targ->IsClient())
c = targ->CastToClient();
auto it = npc_list.begin();
while (it != npc_list.end()) {
if (it->second->CheckAggro(targ))
if (it->second->CheckAggro(targ)) {
if (c)
c->RemoveXTarget(it->second, false);
it->second->RemoveFromHateList(targ);
}
it->second->RemoveFromFeignMemory(targ->CastToClient()); //just in case we feigned
++it;
}