Simplify collection initialization

This commit is contained in:
Eduardo Cáceres
2022-05-02 13:24:49 +02:00
committed by atlimit8
parent cae43808d9
commit aa998a46d9
9 changed files with 55 additions and 35 deletions

View File

@@ -161,9 +161,11 @@ namespace OpenRA.Mods.Common.Traits
if (specificOwnerInfo != null && !specificOwnerInfo.ValidOwnerNames.Contains(ownerName))
ownerName = specificOwnerInfo.ValidOwnerNames.First();
var reference = new ActorReference(actor.Name);
reference.Add(new OwnerInit(ownerName));
reference.Add(new FactionInit(owner.Faction));
var reference = new ActorReference(actor.Name)
{
new OwnerInit(ownerName),
new FactionInit(owner.Faction)
};
var worldPx = wr.Viewport.ViewToWorldPx(Viewport.LastMousePos) - wr.ScreenPxOffset(actorCenterOffset);
var cell = wr.Viewport.ViewToWorld(wr.Viewport.WorldToViewPx(worldPx));