Core/Map: Fix a crash that could happen if a player moved very far away from a creature they were in combat with.
Port From (https://github.com/TrinityCore/TrinityCore/commit/b00d3812ab1b40636c79889e705042d8198b0c17)
This commit is contained in:
@@ -762,13 +762,17 @@ namespace Game.Maps
|
||||
// Handle updates for creatures in combat with player and are more than 60 yards away
|
||||
if (player.IsInCombat())
|
||||
{
|
||||
List<Unit> toVisit = new();
|
||||
foreach (var pair in player.GetCombatManager().GetPvECombatRefs())
|
||||
{
|
||||
Creature unit = pair.Value.GetOther(player).ToCreature();
|
||||
if (unit != null)
|
||||
if (unit.GetMapId() == player.GetMapId() && !unit.IsWithinDistInMap(player, GetVisibilityRange(), false))
|
||||
VisitNearbyCellsOf(unit, grid_object_update, world_object_update);
|
||||
toVisit.Add(unit);
|
||||
}
|
||||
|
||||
foreach (Unit unit in toVisit)
|
||||
VisitNearbyCellsOf(unit, grid_object_update, world_object_update);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user