Fix actors with no footprint not being copied and pasted
This commit is contained in:
@@ -116,16 +116,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
screenMap.Add(preview, preview.Bounds);
|
screenMap.Add(preview, preview.Bounds);
|
||||||
|
|
||||||
foreach (var kv in preview.Footprint)
|
foreach (var kv in preview.Footprint)
|
||||||
{
|
AddPreviewLocation(preview, kv.Key);
|
||||||
List<EditorActorPreview> list;
|
|
||||||
if (!cellMap.TryGetValue(kv.Key, out list))
|
|
||||||
{
|
|
||||||
list = new List<EditorActorPreview>();
|
|
||||||
cellMap.Add(kv.Key, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
if (!initialSetup)
|
||||||
{
|
{
|
||||||
@@ -207,6 +202,18 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
p.ReplaceInit(new RuntimeNeighbourInit(NeighbouringPreviews(p.Footprint)));
|
p.ReplaceInit(new RuntimeNeighbourInit(NeighbouringPreviews(p.Footprint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddPreviewLocation(EditorActorPreview preview, CPos location)
|
||||||
|
{
|
||||||
|
List<EditorActorPreview> list;
|
||||||
|
if (!cellMap.TryGetValue(location, out list))
|
||||||
|
{
|
||||||
|
list = new List<EditorActorPreview>();
|
||||||
|
cellMap.Add(location, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Add(preview);
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<CPos, string[]> NeighbouringPreviews(IReadOnlyDictionary<CPos, SubCell> footprint)
|
Dictionary<CPos, string[]> NeighbouringPreviews(IReadOnlyDictionary<CPos, SubCell> footprint)
|
||||||
{
|
{
|
||||||
var cells = Util.ExpandFootprint(footprint.Keys, true).Except(footprint.Keys);
|
var cells = Util.ExpandFootprint(footprint.Keys, true).Except(footprint.Keys);
|
||||||
|
|||||||
Reference in New Issue
Block a user