From c68faf108edf50ae8a2ff4a341eff1e0d4269cbc 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 --- src/server/game/Maps/Map.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/server') 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 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 -- cgit v1.2.3