aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-09-06 21:38:12 +0200
committerShauren <shauren.trinity@gmail.com>2022-02-05 13:46:49 +0100
commitca498ffab23e9be7a4ffc6ea6adbfa3c01d5e6f6 (patch)
treee1d34ae15a05990e39917a0348335723907ca7d7 /src
parentebdb6d80bb4e9cac5c5b2e177df930d000b79444 (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 (cherry picked from commit c68faf108edf50ae8a2ff4a341eff1e0d4269cbc)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Maps/Map.cpp14
1 files changed, 14 insertions, 0 deletions
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<Unit*> 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