From 599509e71f609374f6df35319f6793a32ded3455 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 5 Dec 2009 21:16:46 +1300 Subject: [PATCH] #96 fixed --- OpenRa.Game/PathSearch.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/OpenRa.Game/PathSearch.cs b/OpenRa.Game/PathSearch.cs index 34aac4c7d4..cb2bc4dcd2 100755 --- a/OpenRa.Game/PathSearch.cs +++ b/OpenRa.Game/PathSearch.cs @@ -32,6 +32,10 @@ namespace OpenRa.Game var p = queue.Pop(); cellInfo[ p.Location.X, p.Location.Y ].Seen = true; + if (!ignoreTerrain) + if (passableCost[(int)umt][p.Location.X, p.Location.Y] == float.PositiveInfinity) + return p.Location; + foreach( int2 d in Util.directions ) { int2 newHere = p.Location + d; @@ -96,23 +100,21 @@ namespace OpenRa.Game return search; } - public static PathSearch FromPoints( IEnumerable froms, int2 target, UnitMovementType umt, bool checkForBlocked ) + public static PathSearch FromPoints(IEnumerable froms, int2 target, UnitMovementType umt, bool checkForBlocked) { - var search = new PathSearch { - heuristic = DefaultEstimator( target ), + var search = new PathSearch + { + heuristic = DefaultEstimator(target), umt = umt, - checkForBlocked = checkForBlocked }; + checkForBlocked = checkForBlocked + }; - foreach( var sl in froms ) - search.AddInitialCell( sl ); + foreach (var sl in froms) + search.AddInitialCell(sl); return search; } - - - - static CellInfo[ , ] InitCellInfo() { var cellInfo = new CellInfo[ 128, 128 ];