From e61ef4a93ffc931f4aeaee243eb60bc576e638b4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 24 Oct 2009 22:45:37 +1300 Subject: [PATCH] temporarily made all units block pathing --- OpenRa.Game/Game.cs | 2 +- OpenRa.Game/PathFinder.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 607db31896..ec70620d16 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -64,7 +64,7 @@ namespace OpenRa.Game LoadMapBuildings(mapFile); LoadMapUnits(mapFile); - pathFinder = new PathFinder(map, terrain.tileSet, BuildingInfluence); + pathFinder = new PathFinder(map, terrain.tileSet); network = new Network(); diff --git a/OpenRa.Game/PathFinder.cs b/OpenRa.Game/PathFinder.cs index 903f9ce0c3..6de7546ba2 100644 --- a/OpenRa.Game/PathFinder.cs +++ b/OpenRa.Game/PathFinder.cs @@ -9,12 +9,10 @@ namespace OpenRa.Game { double[ , ] passableCost = new double[ 128, 128 ]; Map map; - BuildingInfluenceMap bim; - public PathFinder(Map map, TileSet tileSet, BuildingInfluenceMap bim) + public PathFinder(Map map, TileSet tileSet) { this.map = map; - this.bim = bim; for( int x = 0 ; x < 128 ; x++ ) for( int y = 0 ; y < 128 ; y++ ) @@ -64,7 +62,9 @@ namespace OpenRa.Game continue; if( passableCost[ newHere.X, newHere.Y ] == double.PositiveInfinity ) continue; - if (bim.GetBuildingAt(newHere - offset) != null) + if (Game.BuildingInfluence.GetBuildingAt(newHere - offset) != null) + continue; + if (Game.UnitInfluence.GetUnitAt(newHere - offset) != null) continue; double cellCost = ( ( d.X * d.Y != 0 ) ? 1.414213563 : 1.0 ) * passableCost[ newHere.X, newHere.Y ];