From 707befe060c032cfe6965620f14b77b6a8437177 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 16 Aug 2024 20:27:51 +0200 Subject: [PATCH] GameEvent: Defer GameEventUpdateCreatureDataInMapsWorker to map itself --- src/game/GameEvents/GameEventMgr.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/game/GameEvents/GameEventMgr.cpp b/src/game/GameEvents/GameEventMgr.cpp index 9fd3b3754a4..0a7e17dfef2 100644 --- a/src/game/GameEvents/GameEventMgr.cpp +++ b/src/game/GameEvents/GameEventMgr.cpp @@ -1139,14 +1139,17 @@ struct GameEventUpdateCreatureDataInMapsWorker void operator()(Map* map) { - if (Creature* pCreature = map->GetCreature(i_guid)) + map->GetMessager().AddMessage([guid = i_guid, data = i_data, activate = i_activate, event_data = i_event_data](Map* map) { - pCreature->UpdateEntry(i_data->id, i_data, i_activate ? i_event_data : nullptr); + if (Creature* pCreature = map->GetCreature(guid)) + { + pCreature->UpdateEntry(data->id, data, activate ? event_data : nullptr); - // spells not casted for event remove case (sent nullptr into update), do it - if (!i_activate) - pCreature->ApplyGameEventSpells(i_event_data, false); - } + // spells not casted for event remove case (sent nullptr into update), do it + if (!activate) + pCreature->ApplyGameEventSpells(event_data, false); + } + }); } ObjectGuid i_guid;