Remove enemy territory avoidance in FindResources.

This is called from the inner loop of the pathfinder, so cannot afford
to do actor queries etc. It also didn't have the desired effect --
harvesters still wander through enemy territory even with the bias.

Just rip it out for a perf win.
This commit is contained in:
Chris Forbes
2014-11-22 17:29:43 +13:00
parent f4e5c63408
commit 68309af233

View File

@@ -52,13 +52,8 @@ namespace OpenRA.Mods.RA.Activities
var searchRadiusSquared = searchRadius * searchRadius;
// Find harvestable resources nearby:
// Avoid enemy territory:
// TODO: calculate weapons ranges of units and factor those in instead of hard-coding 8.
var path = self.World.WorldActor.Trait<PathFinder>().FindPath(
PathSearch.Search(self.World, mobileInfo, self, true)
.WithCustomCost(loc => self.World.FindActorsInCircle(self.World.Map.CenterOfCell(loc), WRange.FromCells(8))
.Where(u => !u.Destroyed && self.Owner.Stances[u.Owner] == Stance.Enemy)
.Sum(u => Math.Max(0, 64 - (loc - u.Location).LengthSquared)))
.WithHeuristic(loc =>
{
// Avoid this cell: