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 ++++ tools/makeroads.js | 30 +++ tools/roads.svg | 693 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 776 insertions(+) create mode 100644 tools/genroads.js create mode 100644 tools/makeroads.js create mode 100644 tools/roads.svg (limited to 'tools') 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(" + +`) + +for (let id in data.ROADS) { + id = id | 0 + let a = (id / 100) | 0 + let b = id % 100 + let x = (data.TOWNS[a].layout.x + data.TOWNS[b].layout.x) >> 1 + let y = (data.TOWNS[a].layout.y + data.TOWNS[b].layout.y) >> 1 + let label = data.TOWNS[a].name + " / " + data.TOWNS[b].name + print(``) +} + +print(``) diff --git a/tools/roads.svg b/tools/roads.svg new file mode 100644 index 0000000..0797f57 --- /dev/null +++ b/tools/roads.svg @@ -0,0 +1,693 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3