diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2018-02-01 13:10:51 -0300 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-08-28 15:59:11 +0200 |
| commit | 65dca120d34febdaa84a63e17f638ab0fa59b3df (patch) | |
| tree | 6e9cdb496c1c5208ac438c3ce8ad4da5726ab2e4 /src/server/game/Maps | |
| parent | f3548d45d0a74203ef6f5c7282c31ba794ddf7a1 (diff) | |
Core/Spells: rework part 4: iterate over effects first
Ref #18395
Implement far spell queue processing
Closes #7395
(cherry picked from commit 080d2c6cd439acb2059adc4e24a279de98aa0db6)
Diffstat (limited to 'src/server/game/Maps')
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 14 | ||||
| -rw-r--r-- | src/server/game/Maps/Map.h | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index fc2c950b57c..81578dbc41a 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3534,8 +3534,22 @@ bool Map::IsSpawnGroupActive(uint32 groupId) const return (_toggledSpawnGroupIds.find(groupId) != _toggledSpawnGroupIds.end()) != !(data->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN); } +void Map::AddFarSpellCallback(FarSpellCallback&& callback) +{ + _farSpellCallbacks.Enqueue(new FarSpellCallback(std::move(callback))); +} + void Map::DelayedUpdate(uint32 t_diff) { + { + FarSpellCallback* callback; + while (_farSpellCallbacks.Dequeue(callback)) + { + (*callback)(this); + delete callback; + } + } + for (_transportsUpdateIter = _transports.begin(); _transportsUpdateIter != _transports.end();) { Transport* transport = *_transportsUpdateIter; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 3362670dbb3..44c46c9219c 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -27,6 +27,7 @@ #include "GridRefManager.h" #include "MapDefines.h" #include "MapRefManager.h" +#include "MPSCQueue.h" #include "ObjectGuid.h" #include "Optional.h" #include "SharedDefines.h" @@ -775,6 +776,9 @@ class TC_GAME_API Map : public GridRefManager<NGridType> // This will not affect any already-present creatures in the group void SetSpawnGroupInactive(uint32 groupId) { SetSpawnGroupActive(groupId, false); } + typedef std::function<void(Map*)> FarSpellCallback; + void AddFarSpellCallback(FarSpellCallback&& callback); + private: // Type specific code for add/remove to/from grid template<class T> @@ -839,6 +843,8 @@ class TC_GAME_API Map : public GridRefManager<NGridType> std::unordered_set<Corpse*> _corpseBones; std::unordered_set<Object*> _updateObjects; + + MPSCQueue<FarSpellCallback> _farSpellCallbacks; }; enum InstanceResetMethod |
