added building influence to pathfinder
This commit is contained in:
@@ -9,10 +9,12 @@ namespace OpenRa.Game
|
||||
{
|
||||
double[ , ] passableCost = new double[ 128, 128 ];
|
||||
Map map;
|
||||
BuildingInfluenceMap bim;
|
||||
|
||||
public PathFinder(Map map, TileSet tileSet)
|
||||
public PathFinder(Map map, TileSet tileSet, BuildingInfluenceMap bim)
|
||||
{
|
||||
this.map = map;
|
||||
this.bim = bim;
|
||||
|
||||
for( int x = 0 ; x < 128 ; x++ )
|
||||
for( int y = 0 ; y < 128 ; y++ )
|
||||
@@ -59,6 +61,8 @@ namespace OpenRa.Game
|
||||
continue;
|
||||
if( passableCost[ newHere.X, newHere.Y ] == double.PositiveInfinity )
|
||||
continue;
|
||||
if (bim[newHere - offset] != null)
|
||||
continue;
|
||||
|
||||
double cellCost = ( ( d.X * d.Y != 0 ) ? 1.414213563 : 1.0 ) * passableCost[ newHere.X, newHere.Y ];
|
||||
double newCost = cellInfo[ here.X, here.Y ].MinCost + cellCost;
|
||||
|
||||
Reference in New Issue
Block a user