Fix #558 - deadlock on heal checking encounter state of existing aggroed npcs on the person being healed
This commit is contained in:
parent
8f35ab39d7
commit
39ac029ffc
1 changed files with 3 additions and 2 deletions
|
@ -696,14 +696,15 @@ bool Entity::SpellHeal(Spawn* target, float distance, LuaSpell* luaspell, string
|
||||||
int32 hate_amt = heal_amt / 2;
|
int32 hate_amt = heal_amt / 2;
|
||||||
set<int32>::iterator itr;
|
set<int32>::iterator itr;
|
||||||
((Entity*)target)->MHatedBy.lock();
|
((Entity*)target)->MHatedBy.lock();
|
||||||
for (itr = ((Entity*)target)->HatedBy.begin(); itr != ((Entity*)target)->HatedBy.end(); itr++) {
|
set<int32> hatedByCopy(((Entity*)target)->HatedBy);
|
||||||
|
((Entity*)target)->MHatedBy.unlock();
|
||||||
|
for (itr = hatedByCopy.begin(); itr != hatedByCopy.end(); itr++) {
|
||||||
Spawn* spawn = GetZone()->GetSpawnByID(*itr);
|
Spawn* spawn = GetZone()->GetSpawnByID(*itr);
|
||||||
if (spawn && spawn->IsEntity() && target != this) {
|
if (spawn && spawn->IsEntity() && target != this) {
|
||||||
CheckEncounterState((Entity*)spawn);
|
CheckEncounterState((Entity*)spawn);
|
||||||
((Entity*)spawn)->AddHate(this, hate_amt);
|
((Entity*)spawn)->AddHate(this, hate_amt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
((Entity*)target)->MHatedBy.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue