Cache lookups in DeliverResources constructor

Only re-check for refinery every 5 seconds instead of every second.
This commit is contained in:
reaperrr
2015-07-02 21:08:38 +02:00
parent 27c6f5d6d6
commit 8253573ced
3 changed files with 23 additions and 10 deletions

View File

@@ -237,7 +237,7 @@ namespace OpenRA.Mods.Common.Traits
// Are we not empty? Deliver resources:
if (!IsEmpty)
{
self.QueueActivity(new DeliverResources());
self.QueueActivity(new DeliverResources(self));
return;
}
@@ -378,10 +378,11 @@ namespace OpenRA.Mods.Common.Traits
self.SetTargetLine(Target.FromOrder(self.World, order), Color.Green);
self.CancelActivity();
self.QueueActivity(new DeliverResources());
var next = new DeliverResources(self);
self.QueueActivity(next);
var notify = self.TraitsImplementing<INotifyHarvesterAction>();
var next = new DeliverResources();
foreach (var n in notify)
n.MovingToRefinery(self, order.TargetLocation, next);
}