From ca498ffab23e9be7a4ffc6ea6adbfa3c01d5e6f6 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sun, 6 Sep 2020 21:38:12 +0200 Subject: 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 (cherry picked from commit c68faf108edf50ae8a2ff4a341eff1e0d4269cbc) --- src/server/game/Maps/Map.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 26ade43a1de..cb619b1af04 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -910,6 +910,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 toVisit; + + // Totems + for (ObjectGuid const& summonGuid : player->m_SummonSlot) + if (!summonGuid.IsEmpty()) + 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 -- cgit v1.2.3