Remove vestigial direction-sorting machinery from PathSearch
This commit is contained in:
@@ -33,7 +33,6 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
MobileInfo mobileInfo;
|
MobileInfo mobileInfo;
|
||||||
Func<CPos, int> customCost;
|
Func<CPos, int> customCost;
|
||||||
Func<CPos, bool> customBlock;
|
Func<CPos, bool> customBlock;
|
||||||
Pair<CVec, int>[] nextDirections;
|
|
||||||
int laneBias = 1;
|
int laneBias = 1;
|
||||||
|
|
||||||
public PathSearch(World world, MobileInfo mobileInfo, Actor self)
|
public PathSearch(World world, MobileInfo mobileInfo, Actor self)
|
||||||
@@ -46,7 +45,6 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
Queue = new PriorityQueue<PathDistance>();
|
Queue = new PriorityQueue<PathDistance>();
|
||||||
Considered = new HashSet<CPos>();
|
Considered = new HashSet<CPos>();
|
||||||
MaxCost = 0;
|
MaxCost = 0;
|
||||||
nextDirections = CVec.directions.Select(d => new Pair<CVec, int>(d, 0)).ToArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PathSearch Search(World world, MobileInfo mi, Actor self, bool checkForBlocked)
|
public static PathSearch Search(World world, MobileInfo mi, Actor self, bool checkForBlocked)
|
||||||
@@ -170,10 +168,11 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
// This current cell is ok; check all immediate directions:
|
// This current cell is ok; check all immediate directions:
|
||||||
Considered.Add(p.Location);
|
Considered.Add(p.Location);
|
||||||
|
|
||||||
for (var i = 0; i < nextDirections.Length; ++i)
|
var directions = CVec.directions;
|
||||||
|
|
||||||
|
for (var i = 0; i < directions.Length; ++i)
|
||||||
{
|
{
|
||||||
var d = nextDirections[i].First;
|
var d = directions[i];
|
||||||
nextDirections[i].Second = int.MaxValue;
|
|
||||||
|
|
||||||
var newHere = p.Location + d;
|
var newHere = p.Location + d;
|
||||||
|
|
||||||
@@ -239,7 +238,6 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
hereCell.MinCost = newCost;
|
hereCell.MinCost = newCost;
|
||||||
CellInfo[newHere] = hereCell;
|
CellInfo[newHere] = hereCell;
|
||||||
|
|
||||||
nextDirections[i].Second = newCost + est;
|
|
||||||
Queue.Add(new PathDistance(newCost + est, newHere));
|
Queue.Add(new PathDistance(newCost + est, newHere));
|
||||||
|
|
||||||
if (newCost > MaxCost)
|
if (newCost > MaxCost)
|
||||||
@@ -248,8 +246,6 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
Considered.Add(newHere);
|
Considered.Add(newHere);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort to prefer the cheaper direction:
|
|
||||||
// Array.Sort(nextDirections, (a, b) => a.Second.CompareTo(b.Second));
|
|
||||||
return p.Location;
|
return p.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user