diff --git a/OpenRA.Game/PathSearch.cs b/OpenRA.Game/PathSearch.cs index 0ee86d73ac..4a5fae1966 100755 --- a/OpenRA.Game/PathSearch.cs +++ b/OpenRA.Game/PathSearch.cs @@ -39,14 +39,13 @@ namespace OpenRA BuildingInfluence buildingInfluence; UnitInfluence unitInfluence; - public PathSearch() + public PathSearch(World world) { cellInfo = InitCellInfo(); queue = new PriorityQueue(); - // hack: should be passing in World, not using Game.world. - buildingInfluence = Game.world.WorldActor.traits.Get(); - unitInfluence = Game.world.WorldActor.traits.Get(); + buildingInfluence = world.WorldActor.traits.Get(); + unitInfluence = world.WorldActor.traits.Get(); } public PathSearch WithCustomBlocker(Func customBlock) @@ -140,7 +139,7 @@ namespace OpenRA 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 ), umt = umt, checkForBlocked = checkForBlocked }; @@ -151,7 +150,7 @@ namespace OpenRA public static PathSearch FromPoints(World world, IEnumerable froms, int2 target, UnitMovementType umt, bool checkForBlocked) { - var search = new PathSearch + var search = new PathSearch(world) { heuristic = DefaultEstimator(target), umt = umt, diff --git a/OpenRA.Game/Traits/Activities/DeliverOre.cs b/OpenRA.Game/Traits/Activities/DeliverOre.cs index 500ac21d90..2851ad67b0 100644 --- a/OpenRA.Game/Traits/Activities/DeliverOre.cs +++ b/OpenRA.Game/Traits/Activities/DeliverOre.cs @@ -40,7 +40,7 @@ namespace OpenRA.Traits.Activities { var mobile = self.traits.Get(); - var search = new PathSearch + var search = new PathSearch(self.World) { heuristic = PathSearch.DefaultEstimator(self.Location), umt = mobile.GetMovementType(), diff --git a/OpenRA.Game/Traits/Activities/Harvest.cs b/OpenRA.Game/Traits/Activities/Harvest.cs index c40a4769b8..597d57d00a 100644 --- a/OpenRA.Game/Traits/Activities/Harvest.cs +++ b/OpenRA.Game/Traits/Activities/Harvest.cs @@ -72,7 +72,7 @@ namespace OpenRA.Traits.Activities self.QueueActivity(new Move( () => { - var search = new PathSearch + var search = new PathSearch(self.World) { heuristic = loc => (res.GetResource(loc) != null && harv.Resources.Contains( res.GetResource(loc).Name )) ? 0 : 1,