Replace only use of Linq syntax

This commit is contained in:
atlimit8
2015-09-18 10:31:41 -05:00
parent 4fa20e78fa
commit be010249d7

View File

@@ -158,11 +158,13 @@ namespace OpenRA.Mods.Common.Traits
public Actor ClosestProc(Actor self, Actor ignore)
{
// Find all refineries and their occupancy count:
var refs = (
from r in self.World.ActorsWithTrait<IAcceptResources>()
where r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor)
let linkedHarvs = self.World.ActorsWithTrait<Harvester>().Count(a => a.Trait.LinkedProc == r.Actor)
select new { Location = r.Actor.Location + r.Trait.DeliveryOffset, Actor = r.Actor, Occupancy = linkedHarvs }).ToDictionary(r => r.Location);
var refs = self.World.ActorsWithTrait<IAcceptResources>()
.Where(r => r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor))
.Select(r => new {
Location = r.Actor.Location + r.Trait.DeliveryOffset,
Actor = r.Actor,
Occupancy = self.World.ActorsWithTrait<Harvester>().Count(a => a.Trait.LinkedProc == r.Actor) })
.ToDictionary(r => r.Location);
// Start a search from each refinery's delivery location:
var mi = self.Info.Traits.Get<MobileInfo>();