Skip to content

Commit

Permalink
GameEvent: Defer GameEventUpdateCreatureDataInMapsWorker to map itself
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Aug 16, 2024
1 parent b96ace5 commit 707befe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/game/GameEvents/GameEventMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 707befe

Please sign in to comment.