diff --git a/src/Pathfinder.cs b/src/Pathfinder.cs index 6414261..bd0d14a 100644 --- a/src/Pathfinder.cs +++ b/src/Pathfinder.cs @@ -14,7 +14,7 @@ namespace WorldOfPeacecraft public uint Y; } - public static unsafe LinkedList FindPath (Coordinate posFrom, Coordinate posTo, ITile[,] map) + public static unsafe LinkedList FindPath (Coordinate posFrom, Coordinate posTo, Map map) { PathNode nFrom; nFrom.X = (uint) posFrom.X; @@ -22,12 +22,13 @@ namespace WorldOfPeacecraft PathNode nTo; nTo.X = (uint) posTo.X; nTo.Y = (uint) posTo.Y; - uint mapWidth = (uint) map.GetLength (0); - uint mapHeight = (uint) map.GetLength (1); + Tile[,] tiles = map.GetTiles(); + uint mapWidth = (uint) tiles.GetLength (0); + uint mapHeight = (uint) tiles.GetLength (1); bool* boolMap = stackalloc bool[(int)(mapWidth * mapHeight)]; for (int y = 0; y < mapHeight; y++) { for (int x = 0; x < mapWidth; x++) { - boolMap [x + y * mapWidth] = map [x, y].IsWalkable (); + boolMap [x + y * mapWidth] = tiles [x, y].IsWalkable (); } } PathNode* result = stackalloc PathNode[(int) (mapHeight * mapWidth)];