unhack that a bit
This commit is contained in:
@@ -39,14 +39,13 @@ namespace OpenRA
|
|||||||
BuildingInfluence buildingInfluence;
|
BuildingInfluence buildingInfluence;
|
||||||
UnitInfluence unitInfluence;
|
UnitInfluence unitInfluence;
|
||||||
|
|
||||||
public PathSearch()
|
public PathSearch(World world)
|
||||||
{
|
{
|
||||||
cellInfo = InitCellInfo();
|
cellInfo = InitCellInfo();
|
||||||
queue = new PriorityQueue<PathDistance>();
|
queue = new PriorityQueue<PathDistance>();
|
||||||
|
|
||||||
// hack: should be passing in World, not using Game.world.
|
buildingInfluence = world.WorldActor.traits.Get<BuildingInfluence>();
|
||||||
buildingInfluence = Game.world.WorldActor.traits.Get<BuildingInfluence>();
|
unitInfluence = world.WorldActor.traits.Get<UnitInfluence>();
|
||||||
unitInfluence = Game.world.WorldActor.traits.Get<UnitInfluence>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathSearch WithCustomBlocker(Func<int2, bool> customBlock)
|
public PathSearch WithCustomBlocker(Func<int2, bool> customBlock)
|
||||||
@@ -140,7 +139,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static PathSearch FromPoint( World world, int2 from, int2 target, UnitMovementType umt, bool checkForBlocked )
|
public static PathSearch FromPoint( World world, int2 from, int2 target, UnitMovementType umt, bool checkForBlocked )
|
||||||
{
|
{
|
||||||
var search = new PathSearch {
|
var search = new PathSearch(world) {
|
||||||
heuristic = DefaultEstimator( target ),
|
heuristic = DefaultEstimator( target ),
|
||||||
umt = umt,
|
umt = umt,
|
||||||
checkForBlocked = checkForBlocked };
|
checkForBlocked = checkForBlocked };
|
||||||
@@ -151,7 +150,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static PathSearch FromPoints(World world, IEnumerable<int2> froms, int2 target, UnitMovementType umt, bool checkForBlocked)
|
public static PathSearch FromPoints(World world, IEnumerable<int2> froms, int2 target, UnitMovementType umt, bool checkForBlocked)
|
||||||
{
|
{
|
||||||
var search = new PathSearch
|
var search = new PathSearch(world)
|
||||||
{
|
{
|
||||||
heuristic = DefaultEstimator(target),
|
heuristic = DefaultEstimator(target),
|
||||||
umt = umt,
|
umt = umt,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Traits.Activities
|
|||||||
{
|
{
|
||||||
var mobile = self.traits.Get<Mobile>();
|
var mobile = self.traits.Get<Mobile>();
|
||||||
|
|
||||||
var search = new PathSearch
|
var search = new PathSearch(self.World)
|
||||||
{
|
{
|
||||||
heuristic = PathSearch.DefaultEstimator(self.Location),
|
heuristic = PathSearch.DefaultEstimator(self.Location),
|
||||||
umt = mobile.GetMovementType(),
|
umt = mobile.GetMovementType(),
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace OpenRA.Traits.Activities
|
|||||||
self.QueueActivity(new Move(
|
self.QueueActivity(new Move(
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
var search = new PathSearch
|
var search = new PathSearch(self.World)
|
||||||
{
|
{
|
||||||
heuristic = loc => (res.GetResource(loc) != null
|
heuristic = loc => (res.GetResource(loc) != null
|
||||||
&& harv.Resources.Contains( res.GetResource(loc).Name )) ? 0 : 1,
|
&& harv.Resources.Contains( res.GetResource(loc).Name )) ? 0 : 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user