diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-11-12 03:04:36 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-11-18 00:46:17 +0100 |
commit | 8063f3b9ba28d439cad6c8317d3b58796d5a5ddb (patch) | |
tree | e7597d9119bf60c43a44e96268e7734a140be8e9 /tools/makeroads.js | |
parent | e66e845ef1d691d2086afc7984ec5807706a6121 (diff) | |
download | crusader-rex-8063f3b9ba28d439cad6c8317d3b58796d5a5ddb.tar.gz |
Show road limits.
Use maps instead of objects for road_limit, last_used and main_road.
Diffstat (limited to 'tools/makeroads.js')
-rw-r--r-- | tools/makeroads.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/makeroads.js b/tools/makeroads.js new file mode 100644 index 0000000..edff0b9 --- /dev/null +++ b/tools/makeroads.js @@ -0,0 +1,30 @@ +const print = console.log + +const data = require("../data.js") + +var w = 1275 +var h = 2475 +var m = "../map75.png" + +print(`<?xml version="1.0" encoding="UTF-8"?> +<svg + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="${w}" + height="${h}" +> +<image xlink:href="${m}" x="0" y="0" width="${w}" height="${h}" image-rendering="pixelated" sodipodi:insensitive="true" />`) + +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(`<circle inkscape:label="${label}" cx="${x}" cy="${y}" r="12"/>`) +} + +print(`</svg>`) |