Improved the performance and intelligence of resource harvesting by

refactoring the Harvesters' pathfinding. Now they in first place assess
which is the closest resource inside their search area and then a path is
calculated

Changed the way harvesters find resources by always trying to find the
closest resource to their refinery.

Changed the strategy of finding to find resources in Annulus.
This commit is contained in:
David Jiménez
2015-03-13 14:58:22 +01:00
committed by reaperrr
parent a0dc38c252
commit 787609d51e
6 changed files with 154 additions and 132 deletions

View File

@@ -110,6 +110,7 @@ namespace OpenRA.Mods.Common.Pathfinder
public bool Debug { get; set; }
string id;
protected Func<CPos, int> heuristic;
protected Func<CPos, bool> isGoal;
// This member is used to compute the ID of PathSearch.
// Essentially, it represents a collection of the initial
@@ -194,8 +195,7 @@ namespace OpenRA.Mods.Common.Pathfinder
public bool IsTarget(CPos location)
{
var locInfo = Graph[location];
return locInfo.EstimatedTotal - locInfo.CostSoFar == 0;
return isGoal(location);
}
public abstract CPos Expand();