use bidi pathing for moving into range (MoveToAdjacent-style hack)

This commit is contained in:
Chris Forbes
2010-12-27 15:33:59 +13:00
parent 3ce055da80
commit 3d47584cd8

View File

@@ -72,14 +72,17 @@ namespace OpenRA.Mods.RA.Move
{ {
using( new PerfSample( "Pathfinder" ) ) using( new PerfSample( "Pathfinder" ) )
{ {
var mobileInfo = self.Info.Traits.Get<MobileInfo>(); var mi = self.Info.Traits.Get<MobileInfo>();
var tilesInRange = world.FindTilesInCircle(target, range) var tilesInRange = world.FindTilesInCircle(target, range)
.Where( t => Mobile.CanEnterCell(self.World, mobileInfo, t, null, true)); .Where( t => Mobile.CanEnterCell(self.World, mi, t, null, true));
var path = FindPath( PathSearch.FromPoints( world, mobileInfo, tilesInRange, src, false ) var path = FindBidiPath(
PathSearch.FromPoints(world, mi, tilesInRange, src, true)
.WithCustomBlocker(AvoidUnitsNear(src, 4, self)),
PathSearch.FromPoint(world, mi, src, target, true)
.WithCustomBlocker(AvoidUnitsNear(src, 4, self)) .WithCustomBlocker(AvoidUnitsNear(src, 4, self))
.InReverse()); .InReverse());
path.Reverse();
return path; return path;
} }
} }