diff options
author | Julien Dessaux | 2024-05-20 22:52:14 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-05-20 22:52:14 +0200 |
commit | 92ef1e8c2e549c4c10c77fbc29adc917f46c3e4d (patch) | |
tree | c217d67a69a6b9db10d9b1ef731a6ec53ba3d21a | |
parent | [node] implement shipyard info retrieval and database caching (diff) | |
download | spacetraders-92ef1e8c2e549c4c10c77fbc29adc917f46c3e4d.tar.gz spacetraders-92ef1e8c2e549c4c10c77fbc29adc917f46c3e4d.tar.bz2 spacetraders-92ef1e8c2e549c4c10c77fbc29adc917f46c3e4d.zip |
Fixed pathing function for probes
-rw-r--r-- | nodejs/lib/utils.ts | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/nodejs/lib/utils.ts b/nodejs/lib/utils.ts index ec3ab09..24aa3b4 100644 --- a/nodejs/lib/utils.ts +++ b/nodejs/lib/utils.ts @@ -64,6 +64,7 @@ type Step = {waypoint: Waypoint, prev: string, fuel: number, total: number}; type ShortestPath = Array<{symbol: string, fuel: number}>; export async function shortestPath(origin: Waypoint, destination: Waypoint, range: number, waypoints: Array<Waypoint>): Promise<ShortestPath> { + if (range === 0) range = Infinity; let backtrace: {[key: string]: Step} = {}; let fuels: {[key: string]: number} = {}; // fuel = distance + 1 per hop let unvisited: {[key: string]: Waypoint} = {}; |