Using Locomotor instead of Info for pathfinding

This commit is contained in:
teinarss
2019-07-07 19:44:39 +02:00
committed by reaperrr
parent c00b13a18e
commit 2ddf9fa826
9 changed files with 41 additions and 29 deletions

View File

@@ -181,7 +181,7 @@ namespace OpenRA.Mods.Common.Activities
// Find any harvestable resources:
List<CPos> path;
using (var search = PathSearch.Search(self.World, locomotorInfo, self, true, loc =>
using (var search = PathSearch.Search(self.World, mobile.Locomotor, self, true, loc =>
domainIndex.IsPassable(self.Location, loc, locomotorInfo) && harv.CanHarvestCell(self, loc) && claimLayer.CanClaimCell(self, loc))
.WithCustomCost(loc =>
{

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
{
List<CPos> path;
using (var search =
PathSearch.FromPoint(self.World, mobile.Info.LocomotorInfo, self, mobile.ToCell, destination, false)
PathSearch.FromPoint(self.World, mobile.Locomotor, self, mobile.ToCell, destination, false)
.WithoutLaneBias())
path = self.World.WorldActor.Trait<IPathFinder>().FindPath(search);
return path;

View File

@@ -137,8 +137,8 @@ namespace OpenRA.Mods.Common.Activities
if (!searchCells.Any())
return NoPath;
using (var fromSrc = PathSearch.FromPoints(self.World, Mobile.Info.LocomotorInfo, self, searchCells, loc, true))
using (var fromDest = PathSearch.FromPoint(self.World, Mobile.Info.LocomotorInfo, self, loc, lastVisibleTargetLocation, true).Reverse())
using (var fromSrc = PathSearch.FromPoints(self.World, Mobile.Locomotor, self, searchCells, loc, true))
using (var fromDest = PathSearch.FromPoint(self.World, Mobile.Locomotor, self, loc, lastVisibleTargetLocation, true).Reverse())
return pathFinder.FindBidiPath(fromSrc, fromDest);
}