This commit is contained in:
Chris Forbes
2009-12-05 21:16:46 +13:00
parent 6c2504c2bf
commit 599509e71f

View File

@@ -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<int2> froms, int2 target, UnitMovementType umt, bool checkForBlocked )
public static PathSearch FromPoints(IEnumerable<int2> 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 ];