Partial rewrite of Canvace.TileMap.findPath.