diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2018-01-04 15:19:37 +0100 |
|---|---|---|
| committer | Treeston <treeston.mmoc@gmail.com> | 2018-01-04 15:19:37 +0100 |
| commit | e0b609a178528995959e5ea54255a3f856e62913 (patch) | |
| tree | c2302067c0046cf693a72f8df1be5735517e96a1 /src/server/game/Maps/Map.cpp | |
| parent | 18f5eae835a0045d1180262bfcc4a2e6cf97c807 (diff) | |
Core/Map: Fix a crash that could happen if a player moved very far away from a creature they were in combat with. Closes #21177.
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 5dac23ddb07..f8d122f99f5 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -792,10 +792,13 @@ void Map::Update(uint32 t_diff) // Handle updates for creatures in combat with player and are more than 60 yards away if (player->IsInCombat()) { + std::vector<Unit*> toVisit; for (auto const& pair : player->GetCombatManager().GetPvECombatRefs()) if (Creature* unit = pair.second->GetOther(player)->ToCreature()) if (unit->GetMapId() == player->GetMapId() && !unit->IsWithinDistInMap(player, GetVisibilityRange(), false)) - VisitNearbyCellsOf(unit, grid_object_update, world_object_update); + toVisit.push_back(unit); + for (Unit* unit : toVisit) + VisitNearbyCellsOf(unit, grid_object_update, world_object_update); } } |
