Fixed harvesters for AI to search the entire map when no more resources nearby.

This commit is contained in:
James Dunne
2012-06-24 20:24:53 -05:00
parent 1fa70d259f
commit b59a0e8c0d
3 changed files with 75 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Activities
{
public class FindResources : Activity
{
CPos avoidCell;
CPos? avoidCell;
public FindResources()
{
@@ -64,7 +64,8 @@ namespace OpenRA.Mods.RA.Activities
})
.WithHeuristic(loc =>
{
if (loc == avoidCell) return 1;
// Avoid this cell:
if (avoidCell.HasValue && loc == avoidCell.Value) return 1;
// Don't harvest out of range:
int distSquared = (loc - (harv.LastOrderLocation ?? harv.LinkedProc.Location)).LengthSquared;