From 8063f3b9ba28d439cad6c8317d3b58796d5a5ddb Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 12 Nov 2023 03:04:36 +0100 Subject: Show road limits. Use maps instead of objects for road_limit, last_used and main_road. --- tools/genroads.js | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tools/genroads.js (limited to 'tools/genroads.js') diff --git a/tools/genroads.js b/tools/genroads.js new file mode 100644 index 0000000..71b1c45 --- /dev/null +++ b/tools/genroads.js @@ -0,0 +1,53 @@ +const fs = require("fs") + +const { round, floor, ceil } = Math + +let output = {} +let mode, name, x, y, w, h, cx, cy, rx, ry + +function flush() { + if (mode === 'circle') { + output[name] = [ cx, cy ] + } + x = y = w = h = cx = cy = rx = ry = 0 + name = null +} + +for (let line of fs.readFileSync("tools/roads.svg", "utf-8").split("\n")) { + line = line.trim() + if (line.startsWith("