diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs index d99386ed2d..72716801ca 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorLayer.cs @@ -116,16 +116,11 @@ namespace OpenRA.Mods.Common.Traits screenMap.Add(preview, preview.Bounds); foreach (var kv in preview.Footprint) - { - List list; - if (!cellMap.TryGetValue(kv.Key, out list)) - { - list = new List(); - cellMap.Add(kv.Key, list); - } + AddPreviewLocation(preview, kv.Key); - list.Add(preview); - } + // Fallback to the actor's CenterPosition for the ActorMap if it has no Footprint + if (!preview.Footprint.Any()) + AddPreviewLocation(preview, worldRenderer.World.Map.CellContaining(preview.CenterPosition)); if (!initialSetup) { @@ -207,6 +202,18 @@ namespace OpenRA.Mods.Common.Traits p.ReplaceInit(new RuntimeNeighbourInit(NeighbouringPreviews(p.Footprint))); } + void AddPreviewLocation(EditorActorPreview preview, CPos location) + { + List list; + if (!cellMap.TryGetValue(location, out list)) + { + list = new List(); + cellMap.Add(location, list); + } + + list.Add(preview); + } + Dictionary NeighbouringPreviews(IReadOnlyDictionary footprint) { var cells = Util.ExpandFootprint(footprint.Keys, true).Except(footprint.Keys);