Make ActorPreview and EditorActorPreview wrap ActorReference.

This commit is contained in:
Paul Chote
2020-06-12 13:21:09 +01:00
committed by reaperrr
parent ae7cfa56b7
commit c6c3a8c60d
22 changed files with 265 additions and 162 deletions

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets
if (!actor.Footprint.All(c => world.Map.Tiles.Contains(c.Key)))
return true;
var action = new AddActorAction(editorLayer, actor.Actor);
var action = new AddActorAction(editorLayer, actor.Export());
editorActionManager.Add(action);
}

View File

@@ -134,11 +134,11 @@ namespace OpenRA.Mods.Common.Widgets
continue;
var copy = preview.Export();
if (copy.InitDict.Contains<LocationInit>())
var locationInit = copy.GetOrDefault<LocationInit>();
if (locationInit != null)
{
var location = copy.InitDict.Get<LocationInit>();
copy.InitDict.Remove(location);
copy.InitDict.Add(new LocationInit(location.Value + offset));
copy.RemoveAll<LocationInit>();
copy.Add(new LocationInit(locationInit.Value + offset));
}
previews.Add(preview.ID, copy);