Merge pull request #9368 from atlimit8/Harvester_linq_syntax
Replace only use of Linq syntax
This commit is contained in:
@@ -158,11 +158,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public Actor ClosestProc(Actor self, Actor ignore)
|
public Actor ClosestProc(Actor self, Actor ignore)
|
||||||
{
|
{
|
||||||
// Find all refineries and their occupancy count:
|
// Find all refineries and their occupancy count:
|
||||||
var refs = (
|
var refs = self.World.ActorsWithTrait<IAcceptResources>()
|
||||||
from r in self.World.ActorsWithTrait<IAcceptResources>()
|
.Where(r => r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor))
|
||||||
where r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor)
|
.Select(r => new {
|
||||||
let linkedHarvs = self.World.ActorsWithTrait<Harvester>().Count(a => a.Trait.LinkedProc == r.Actor)
|
Location = r.Actor.Location + r.Trait.DeliveryOffset,
|
||||||
select new { Location = r.Actor.Location + r.Trait.DeliveryOffset, Actor = r.Actor, Occupancy = linkedHarvs }).ToDictionary(r => r.Location);
|
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:
|
// Start a search from each refinery's delivery location:
|
||||||
var mi = self.Info.Traits.Get<MobileInfo>();
|
var mi = self.Info.Traits.Get<MobileInfo>();
|
||||||
|
|||||||
Reference in New Issue
Block a user