Cache IPathFinder in Mobile at creation

Avoiding look-ups on every move order,
as well as reducing line lengths.
This commit is contained in:
reaperrr
2019-07-26 19:24:26 +02:00
committed by teinarss
parent 27205b30e5
commit 2de51ae73c
2 changed files with 10 additions and 6 deletions

View File

@@ -217,6 +217,8 @@ namespace OpenRA.Mods.Common.Traits
public Locomotor Locomotor { get; private set; }
public IPathFinder Pathfinder { get; private set; }
#region IOccupySpace
[Sync]
@@ -279,6 +281,7 @@ namespace OpenRA.Mods.Common.Traits
notifyMoving = self.TraitsImplementing<INotifyMoving>().ToArray();
notifyFinishedMoving = self.TraitsImplementing<INotifyFinishedMoving>().ToArray();
moveWrappers = self.TraitsImplementing<IWrapMove>().ToArray();
Pathfinder = self.World.WorldActor.Trait<IPathFinder>();
Locomotor = self.World.WorldActor.TraitsImplementing<Locomotor>()
.Single(l => l.Info.Name == Info.Locomotor);