Don't crash if 2 DockHosts overlap

This commit is contained in:
Gustas
2024-08-29 20:59:55 +03:00
committed by Paul Chote
parent f06d7d29ef
commit 67855f2adf

View File

@@ -342,8 +342,10 @@ namespace OpenRA.Mods.Common.Traits
var mobile = clientActor.TraitOrDefault<Mobile>();
if (mobile != null)
{
// Overlapping docks can become hidden.
var lookup = docks.ToDictionary(dock => clientActor.World.Map.CellContaining(dock.Trait.DockPosition));
// Overlapping hosts can become hidden.
var lookup = docks
.GroupBy(dock => clientActor.World.Map.CellContaining(dock.Trait.DockPosition))
.ToDictionary(group => group.Key, group => group.First());
// Start a search from each docks position:
var path = mobile.PathFinder.FindPathToTargetCell(