From a934080d004255e84c14d265d697f5c206a46307 Mon Sep 17 00:00:00 2001 From: killerwife Date: Tue, 29 Oct 2024 09:07:20 +0100 Subject: [PATCH] SpawnGroup: Add cyclic graph trigger protection to spawn group aggro trigger --- src/game/Maps/SpawnGroup.cpp | 7 +++++++ src/game/Maps/SpawnGroup.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/game/Maps/SpawnGroup.cpp b/src/game/Maps/SpawnGroup.cpp index ede19c8f1d..7e0e11467a 100644 --- a/src/game/Maps/SpawnGroup.cpp +++ b/src/game/Maps/SpawnGroup.cpp @@ -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; @@ -441,6 +446,8 @@ void CreatureGroup::TriggerLinkingEvent(uint32 event, Unit* target) CreatureGroup* group = static_cast(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) diff --git a/src/game/Maps/SpawnGroup.h b/src/game/Maps/SpawnGroup.h index 4ca81b52f7..ccd3a90aba 100644 --- a/src/game/Maps/SpawnGroup.h +++ b/src/game/Maps/SpawnGroup.h @@ -100,6 +100,7 @@ class CreatureGroup : public SpawnGroup private: void ClearRespawnTimes(); FormationDataSPtr m_formationData; + std::set m_linkageTargets; }; struct RespawnPosition