From 54cebc3192c3a9ef9047c05762cd3bce34144287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 19 May 2021 19:16:20 +0200 Subject: [PATCH] Reduce broken caching --- src/pathfinding.js | 4 ++++ src/ruler.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/pathfinding.js b/src/pathfinding.js index 397a88f..f7dd58b 100644 --- a/src/pathfinding.js +++ b/src/pathfinding.js @@ -92,3 +92,7 @@ export function find_path(from, to) { } return path; } + +export function wipe_cache() { + cached_nodes = undefined; +} diff --git a/src/ruler.js b/src/ruler.js index 896246c..4ddc3ea 100644 --- a/src/ruler.js +++ b/src/ruler.js @@ -2,6 +2,7 @@ import {currentSpeedProvider, getColorForDistanceAndToken, getRangesFromSpeedPro import {getHexSizeSupportTokenGridCenter} from "./compatibility.js"; import {cancelScheduledMeasurement, measure} from "./foundry_imports.js" import {getMovementHistory} from "./movement_tracking.js"; +import {wipe_cache} from "./pathfinding.js"; import {settingsKey} from "./settings.js"; import {getSnapPointForEntity} from "./util.js"; @@ -176,6 +177,7 @@ export function extendRuler() { return; const ruler = canvas.controls.ruler; ruler.clear(); + wipe_cache(); ruler._state = Ruler.STATES.STARTING; let entityCenter; if (isToken && canvas.grid.isHex && game.modules.get("hex-size-support")?.active && CONFIG.hexSizeSupport.getAltSnappingFlag(entity))