diff options
| author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2020-09-06 21:38:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-06 21:38:12 +0200 |
| commit | c68faf108edf50ae8a2ff4a341eff1e0d4269cbc (patch) | |
| tree | 9931b78b15c2093878fab16d018a474ba84d5218 /src/server/game/Maps/Map.cpp | |
| parent | 5810699ee0341573cee9323bbf282edf56813959 (diff) | |
Core/Maps: Always update the grid of player summons even if far away (#25406)
* Core/Maps: Always update the grid of player summons even if far away
* Code cleanup
* Use a vector instead of unordered_set
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 1b91b4c505a..af90ff94255 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -829,6 +829,20 @@ void Map::Update(uint32 t_diff) for (Unit* unit : toVisit) VisitNearbyCellsOf(unit, grid_object_update, world_object_update); } + + { // Update player's summons + std::vector<Unit*> toVisit; + + // Totems + for (ObjectGuid const& summonGuid : player->m_SummonSlot) + if (summonGuid) + if (Creature* unit = GetCreature(summonGuid)) + if (unit->GetMapId() == player->GetMapId() && !unit->IsWithinDistInMap(player, GetVisibilityRange(), false)) + toVisit.push_back(unit); + + for (Unit* unit : toVisit) + VisitNearbyCellsOf(unit, grid_object_update, world_object_update); + } } // non-player active objects, increasing iterator in the loop in case of object removal |
