diff --git a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs index 910c09b012..bbb597841a 100644 --- a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs +++ b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs @@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Pathfinder public abstract IEnumerable> Considered { get; } - public Player Owner { get { return this.Graph.Actor.Owner; } } + public Player Owner { get { return Graph.Actor.Owner; } } public int MaxCost { get; protected set; } public bool Debug { get; set; } string id; @@ -184,7 +184,7 @@ namespace OpenRA.Mods.Common.Pathfinder public IPathSearch FromPoint(CPos from) { - if (this.Graph.World.Map.Contains(from)) + if (Graph.World.Map.Contains(from)) AddInitialCell(from); return this; diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index 822b2efb60..32db23f576 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits info.DeliveryBuildings.Contains(proc.Info.Name); } - Actor ClosestProc(Actor self, Actor ignore) + public Actor ClosestProc(Actor self, Actor ignore) { // Find all refineries and their occupancy count: var refs = ( @@ -155,14 +155,16 @@ namespace OpenRA.Mods.Common.Traits var mi = self.Info.Traits.Get(); var path = self.World.WorldActor.Trait().FindPath( PathSearch.FromPoints(self.World, mi, self, refs.Values.Select(r => r.Location), self.Location, false) - .WithCustomCost((loc) => + .WithCustomCost(loc => { - if (!refs.ContainsKey(loc)) return 0; + if (!refs.ContainsKey(loc)) + return 0; var occupancy = refs[loc].Occupancy; // 4 harvesters clogs up the refinery's delivery location: - if (occupancy >= 3) return int.MaxValue; + if (occupancy >= 3) + return int.MaxValue; // Prefer refineries with less occupancy (multiplier is to offset distance cost): return occupancy * 12; @@ -199,7 +201,8 @@ namespace OpenRA.Mods.Common.Traits self.SetTargetLine(Target.FromCell(self.World, moveTo), Color.Gray, false); var territory = self.World.WorldActor.TraitOrDefault(); - if (territory != null) territory.ClaimResource(self, moveTo); + if (territory != null) + territory.ClaimResource(self, moveTo); var notify = self.TraitsImplementing(); var next = new FindResources(self); @@ -422,9 +425,9 @@ namespace OpenRA.Mods.Common.Traits if (!harvInfo.Resources.Contains(resType.Info.Name)) return Constants.CellCost; - // Another harvester has claimed this resource: if (territory != null) { + // Another harvester has claimed this resource: ResourceClaim claim; if (territory.IsClaimedByAnyoneElse(self, loc, out claim)) return Constants.CellCost;