added building influence to pathfinder

This commit is contained in:
Chris Forbes
2009-10-13 18:21:57 +13:00
parent 24a6c798fa
commit c6e739d162
2 changed files with 10 additions and 6 deletions

View File

@@ -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;