From 1972498b054910214c36f4a2ce9bee34e1d71706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Sun, 30 Jan 2022 10:16:19 +0100 Subject: [PATCH] Avoid unnecessary diagonal calculation on hex grids --- src/pathfinding.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pathfinding.js b/src/pathfinding.js index 52afdce..97e82ae 100644 --- a/src/pathfinding.js +++ b/src/pathfinding.js @@ -83,7 +83,7 @@ function calculatePath(from, to, previousWaypoints) { if (canvas.grid.diagonalRule === "5105") use5105 = true; let startLayer = 0; - if (use5105) { + if (use5105 && canvas.grid.type === CONST.GRID_TYPES.SQUARE) { previousWaypoints = previousWaypoints.map(w => getGridPositionFromPixelsObj(w)); startLayer = calcNoDiagonals(previousWaypoints) % 2; }