From 26748ee2342caca228d94cb306a5f7fca8c73ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Fri, 4 Mar 2022 08:40:04 +0100 Subject: [PATCH] Revert ebd0ee6ccffeb4078aa2856eb688c20b5f000fb6, which introduced a bug instead of fixing one --- js/pathfinding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/pathfinding.js b/js/pathfinding.js index e1b76da..d361c93 100644 --- a/js/pathfinding.js +++ b/js/pathfinding.js @@ -44,7 +44,7 @@ export function findPath(from, to, token, previousWaypoints) { let currentNode = lastNode; while (currentNode) { // TODO Check if the distance doesn't change - if (path.length >= 2 && !stepCollidesWithWall(currentNode.node, path[path.length - 2], token)) { + if (path.length >= 2 && !stepCollidesWithWall(path[path.length - 2], currentNode.node, token)) // Replace last waypoint if the current waypoint leads to a valid path path[path.length - 1] = {x: currentNode.node.x, y: currentNode.node.y}; else