X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FPathFinder.cs;fp=CarFire%2FCarFire%2FCarFire%2FPathFinder.cs;h=91724384ab2ac4cccca98b2c830b66c0bff2c1e7;hp=8b627ace0bed4f8500132ee33da9b6540615940b;hb=681f16a95c1c67bdd40ed16842a70f8e10ba31e1;hpb=851a2f1efb5e981fad8f517170809b61d630e8b7 diff --git a/CarFire/CarFire/CarFire/PathFinder.cs b/CarFire/CarFire/CarFire/PathFinder.cs index 8b627ac..9172438 100644 --- a/CarFire/CarFire/CarFire/PathFinder.cs +++ b/CarFire/CarFire/CarFire/PathFinder.cs @@ -112,7 +112,7 @@ namespace CarFire mFringe = new BinaryHeap(); mCells = new Cell[mGridWidth, mGridHeight]; - Cell startCell = new Cell(start, 0, GetManhattanDistance(start, finish)); + Cell startCell = new Cell(start, 0, heuristic(start, finish)); mFringe.Add(startCell); mCells[start.X, start.Y] = startCell; while (mFringe.Count > 0) @@ -151,11 +151,11 @@ namespace CarFire if (0 <= point.X && point.X < mGridWidth && 0 <= point.Y && point.Y < mGridHeight && mGrid[point.X, point.Y]) { - int cost = cell.G + GetCost(cell.Point, point); + int cost = cell.G + costFunction(cell.Point, point); if (inQueue == null) { - Cell neighbor = new Cell(point, cost, GetManhattanDistance(point, finish), cell); + Cell neighbor = new Cell(point, cost, heuristic(point, finish), cell); mFringe.Add(neighbor); mCells[point.X, point.Y] = neighbor; }