Core/Spells: rework part 4: iterate over effects first

Port From (https://github.com/TrinityCore/TrinityCore/commit/65dca120d34febdaa84a63e17f638ab0fa59b3df)
This commit is contained in:
hondacrx
2021-08-28 22:35:39 -04:00
parent 091272755c
commit e97ffa304d
6 changed files with 693 additions and 663 deletions
+11
View File
@@ -2836,8 +2836,16 @@ namespace Game.Maps
return _toggledSpawnGroupIds.Contains(groupId) != !data.flags.HasAnyFlag(SpawnGroupFlags.ManualSpawn);
}
public void AddFarSpellCallback(FarSpellCallback callback)
{
_farSpellCallbacks.Enqueue(new FarSpellCallback(callback));
}
public virtual void DelayedUpdate(uint diff)
{
while (_farSpellCallbacks.TryDequeue(out FarSpellCallback callback))
callback(this);
for (var i = 0; i < _transports.Count; ++i)
{
Transport transport = _transports[i];
@@ -4985,6 +4993,9 @@ namespace Game.Maps
List<Corpse> _corpseBones = new();
List<WorldObject> _updateObjects = new();
delegate void FarSpellCallback(Map map);
Queue<FarSpellCallback> _farSpellCallbacks = new();
#endregion
}