diff --git a/OpenRA.Mods.RA/Move/Move.cs b/OpenRA.Mods.RA/Move/Move.cs index 32a813f7b3..b974c6f7e9 100644 --- a/OpenRA.Mods.RA/Move/Move.cs +++ b/OpenRA.Mods.RA/Move/Move.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Move readonly IEnumerable moveDisablers; readonly WRange nearEnough; readonly Func> getPath; - readonly Actor ignoreBuilding; + readonly Actor ignoredActor; List path; CPos? destination; @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA.Move this.nearEnough = nearEnough; } - public Move(Actor self, CPos destination, Actor ignoreBuilding) + public Move(Actor self, CPos destination, Actor ignoredActor) { mobile = self.Trait(); moveDisablers = self.TraitsImplementing(); @@ -85,11 +85,11 @@ namespace OpenRA.Mods.RA.Move getPath = () => self.World.WorldActor.Trait().FindPath( PathSearch.FromPoint(self.World, mobile.Info, self, mobile.toCell, destination, false) - .WithIgnoredBuilding(ignoreBuilding)); + .WithIgnoredActor(ignoredActor)); this.destination = destination; this.nearEnough = WRange.Zero; - this.ignoreBuilding = ignoreBuilding; + this.ignoredActor = ignoredActor; } public Move(Actor self, Target target, WRange range) @@ -219,7 +219,7 @@ namespace OpenRA.Mods.RA.Move var nextCell = path[path.Count - 1]; // Next cell in the move is blocked by another actor - if (!mobile.CanEnterCell(nextCell, ignoreBuilding, true)) + if (!mobile.CanEnterCell(nextCell, ignoredActor, true)) { // Are we close enough? var cellRange = nearEnough.Range / 1024; @@ -268,7 +268,7 @@ namespace OpenRA.Mods.RA.Move hasWaited = false; path.RemoveAt(path.Count - 1); - var subCell = mobile.GetAvailableSubCell(nextCell, SubCell.Any, ignoreBuilding); + var subCell = mobile.GetAvailableSubCell(nextCell, SubCell.Any, ignoredActor); return Pair.New(nextCell, subCell); } diff --git a/OpenRA.Mods.RA/Move/PathFinder.cs b/OpenRA.Mods.RA/Move/PathFinder.cs index 9a98a432c6..5b66d5b764 100644 --- a/OpenRA.Mods.RA/Move/PathFinder.cs +++ b/OpenRA.Mods.RA/Move/PathFinder.cs @@ -69,9 +69,14 @@ namespace OpenRA.Mods.RA.Move return emptyPath; } + var fromPoint = PathSearch.FromPoint(world, mi, self, target, from, true) + .WithIgnoredActor(self); + var fromPointReverse = PathSearch.FromPoint(world, mi, self, from, target, true) + .WithIgnoredActor(self) + .Reverse(); var pb = FindBidiPath( - PathSearch.FromPoint(world, mi, self, target, from, true), - PathSearch.FromPoint(world, mi, self, from, target, true).Reverse() + fromPoint, + fromPointReverse ); CheckSanePath2(pb, from, target); diff --git a/OpenRA.Mods.RA/Move/PathSearch.cs b/OpenRA.Mods.RA/Move/PathSearch.cs index 42d10a37f5..f8fe07beaa 100755 --- a/OpenRA.Mods.RA/Move/PathSearch.cs +++ b/OpenRA.Mods.RA/Move/PathSearch.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Move public PriorityQueue Queue; public Func Heuristic; public bool CheckForBlocked; - public Actor IgnoreBuilding; + public Actor IgnoredActor; public bool InReverse; public HashSet Considered; public Player Owner { get { return self.Owner; } } @@ -108,9 +108,9 @@ namespace OpenRA.Mods.RA.Move return this; } - public PathSearch WithIgnoredBuilding(Actor b) + public PathSearch WithIgnoredActor(Actor b) { - IgnoreBuilding = b; + IgnoredActor = b; return this; } @@ -215,7 +215,7 @@ namespace OpenRA.Mods.RA.Move if (costHere == int.MaxValue) continue; - if (!mobileInfo.CanEnterCell(world, self, newHere, IgnoreBuilding, CheckForBlocked ? CellConditions.TransientActors : CellConditions.None)) + if (!mobileInfo.CanEnterCell(world, self, newHere, IgnoredActor, CheckForBlocked ? CellConditions.TransientActors : CellConditions.None)) continue; if (customBlock != null && customBlock(newHere))