diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 99742496ed..58ba3475d7 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -28,6 +28,7 @@ namespace OpenRA IOccupySpace OccupiesSpace; IHasLocation HasLocation; + Lazy Move; public int2 Location { get { @@ -67,6 +68,8 @@ namespace OpenRA foreach (var trait in Info.TraitsInConstructOrder()) AddTrait(trait.Create(init)); } + + Move = Lazy.New( () => TraitOrDefault() ); Size = Lazy.New(() => { @@ -123,7 +126,7 @@ namespace OpenRA if (si != null && si.Bounds != null && si.Bounds.Length > 2) loc += new float2(si.Bounds[2], si.Bounds[3]); - var move = TraitOrDefault(); + var move = Move.Value; if (move != null) { loc -= new float2(0, move.Altitude);