Skip to content

Commit

Permalink
SpawnGroup: Add cyclic graph trigger protection to spawn group aggro …
Browse files Browse the repository at this point in the history
…trigger
  • Loading branch information
killerwife committed Oct 29, 2024
1 parent 946016a commit a934080
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/game/Maps/SpawnGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ void CreatureGroup::TriggerLinkingEvent(uint32 event, Unit* target)
if (!target->HasCharmer() && m_objects.find(target->GetDbGuid()) != m_objects.end())
return;

if (m_linkageTargets.find(target) != m_linkageTargets.end()) // already triggering for target
return;

m_linkageTargets.insert(target);

for (auto& data : m_objects)
{
uint32 dbGuid = data.first;
Expand All @@ -441,6 +446,8 @@ void CreatureGroup::TriggerLinkingEvent(uint32 event, Unit* target)
CreatureGroup* group = static_cast<CreatureGroup*>(m_map.GetSpawnManager().GetSpawnGroup(linkedGroup));
group->TriggerLinkingEvent(event, target);
}

m_linkageTargets.erase(target);
break;
case CREATURE_GROUP_EVENT_EVADE:
if ((m_entry.Flags & CREATURE_GROUP_EVADE_TOGETHER) != 0)
Expand Down
1 change: 1 addition & 0 deletions src/game/Maps/SpawnGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CreatureGroup : public SpawnGroup
private:
void ClearRespawnTimes();
FormationDataSPtr m_formationData;
std::set<Unit*> m_linkageTargets;
};

struct RespawnPosition
Expand Down

0 comments on commit a934080

Please sign in to comment.