Fixed but in prev (again!) and removed dead code.

This commit is contained in:
Bob
2009-11-09 16:21:39 +13:00
parent 881bed49e9
commit e8ee03bcc6
2 changed files with 2 additions and 24 deletions

View File

@@ -92,7 +92,7 @@ namespace OpenRa.Game
public static PathSearch FromPoints( IEnumerable<int2> froms, int2 target, UnitMovementType umt, bool checkForBlocked )
{
var search = new PathSearch {
var search = new PathSearch {
heuristic = DefaultEstimator( target ),
umt = umt,
checkForBlocked = checkForBlocked };
@@ -103,28 +103,6 @@ namespace OpenRa.Game
return search;
}
public static PathSearch FromPath( List<int2> path, int2 target, UnitMovementType umt, bool checkForBlocked )
{
var search = new PathSearch {
heuristic = DefaultEstimator( target ),
umt = umt,
checkForBlocked = checkForBlocked };
var cost = 0.0f;
var prev = path[ 0 ];
for( int i = 0 ; i < path.Count ; i++ )
{
var sl = path[ i ];
if( Game.BuildingInfluence.CanMoveHere( path[ i ] ) && Game.UnitInfluence.GetUnitAt( path[ i ] ) == null )
search.AddInitialCell( sl );
var d = sl - prev;
cost += ( ( d.X * d.Y != 0 ) ? 1.414213563f : 1.0f );// *passableCost[ (int)umt ][ sl.X, sl.Y ];
prev = sl;
}
return search;
}