Core/Misc: Fix various crashes, also related to multithreading (#19012)
* When iterating groups we have to either do it not in multithreaded context (map updates) or start with checking maps (they are guaranteed to change in single thread update). * Properly clear ComboPoint references on player remove * remove some possible references item may have when it is deleted during save. * Also clear all hostile references when unit is removed from map.
This commit is contained in:
1 parent
a76da51e7f
commit
2c05a59815
20 files changed
+175
-126
No files matched your search
@@ -230,6 +230,8 @@ void SmartAI::EndPath(bool fail)
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||
{
|
||||
Player* groupGuy = groupRef->GetSource();
|
||||
if (!groupGuy->IsInMap(player))
|
||||
continue;
|
||||
|
||||
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->HasCorpse())
|
||||
groupGuy->AreaExploredOrEventHappens(mEscortQuestID);
|
||||
@@ -386,8 +388,7 @@ bool SmartAI::IsEscortInvokerInRange()
|
||||
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
|
||||
{
|
||||
Player* groupGuy = groupRef->GetSource();
|
||||
|
||||
if (me->GetDistance(groupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
|
||||
if (groupGuy->IsInMap(player) && me->GetDistance(groupGuy) <= SMART_ESCORT_MAX_PLAYER_DIST)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user