From 2eab51eede2706ab1c7561da768249d283119e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 6 May 2014 22:11:51 +0200 Subject: [PATCH] FindPath nimmt nun Map statt ITile[,] als Map entgegen --- src/Pathfinder.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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)];