summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-11-12 03:04:36 +0100
committerTor Andersson <tor@ccxvii.net>2023-11-18 00:46:17 +0100
commit8063f3b9ba28d439cad6c8317d3b58796d5a5ddb (patch)
treee7597d9119bf60c43a44e96268e7734a140be8e9 /tools
parente66e845ef1d691d2086afc7984ec5807706a6121 (diff)
downloadcrusader-rex-8063f3b9ba28d439cad6c8317d3b58796d5a5ddb.tar.gz
Show road limits.
Use maps instead of objects for road_limit, last_used and main_road.
Diffstat (limited to 'tools')
-rw-r--r--tools/genroads.js53
-rw-r--r--tools/makeroads.js30
-rw-r--r--tools/roads.svg693
3 files changed, 776 insertions, 0 deletions
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("<rect")) {
+ flush()
+ mode = "rect"
+ x = y = w = h = 0
+ } else if (line.startsWith("<ellipse") || line.startsWith("<circle")) {
+ flush()
+ mode = "circle"
+ cx = cy = rx = ry = 0
+ } else if (line.startsWith('x="'))
+ x = round(Number(line.split('"')[1]))
+ else if (line.startsWith('y="'))
+ y = round(Number(line.split('"')[1]))
+ else if (line.startsWith('width="'))
+ w = round(Number(line.split('"')[1]))
+ else if (line.startsWith('height="'))
+ h = round(Number(line.split('"')[1]))
+ else if (line.startsWith('cx="'))
+ cx = round(Number(line.split('"')[1]))
+ else if (line.startsWith('cy="'))
+ cy = round(Number(line.split('"')[1]))
+ else if (line.startsWith('r="'))
+ rx = ry = round(Number(line.split('"')[1]))
+ else if (line.startsWith('rx="'))
+ rx = round(Number(line.split('"')[1]))
+ else if (line.startsWith('ry="'))
+ ry = round(Number(line.split('"')[1]))
+ else if (line.startsWith('inkscape:label="'))
+ name = line.split('"')[1]
+}
+
+flush()
+
+console.log("const ROADS_XY = {")
+for (let key in output)
+ console.log("\t\"" + key + "\": " + JSON.stringify(output[key]) + ",")
+console.log("}")
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>`)
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 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/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="1275"
+ height="2475"
+ version="1.1"
+ id="svg184"
+ sodipodi:docname="roads.svg"
+ inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
+ <metadata
+ id="metadata190">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs188" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="640"
+ inkscape:window-height="480"
+ id="namedview186"
+ showgrid="false"
+ inkscape:snap-object-midpoints="true"
+ inkscape:zoom="1.2821617"
+ inkscape:cx="130.6621"
+ inkscape:cy="2153.467"
+ inkscape:current-layer="svg184"
+ inkscape:document-rotation="0">
+ <inkscape:grid
+ type="xygrid"
+ id="grid192" />
+ </sodipodi:namedview>
+ <image
+ sodipodi:absref="/home/tor/src/rally/public/crusader-rex/map75.png"
+ xlink:href="../map75.png"
+ id="image2"
+ sodipodi:insensitive="true"
+ image-rendering="pixelated"
+ height="2475"
+ width="1275"
+ y="0"
+ x="0" />
+ <circle
+ inkscape:label="Germania / Aleppo"
+ cx="974.99615"
+ cy="63.622677"
+ r="12"
+ id="circle4"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Germania / St. Simeon"
+ cx="296.58557"
+ cy="99.73616"
+ r="12"
+ id="circle6"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Germania / Antioch"
+ cx="511.75214"
+ cy="54.400223"
+ r="12"
+ id="circle8"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Aleppo / Artah"
+ cx="938.5"
+ cy="147"
+ r="12"
+ id="circle10"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Aleppo / Zerdana"
+ cx="1044.5436"
+ cy="217.55034"
+ r="12"
+ id="circle12"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Artah / Zerdana"
+ cx="940.5"
+ cy="226.5"
+ r="12"
+ id="circle14"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Artah / Harim"
+ cx="760.87262"
+ cy="126.64205"
+ r="12"
+ id="circle16"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Zerdana / Hama"
+ cx="1028"
+ cy="388"
+ r="12"
+ id="circle18"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Zerdana / Albara"
+ cx="941.80188"
+ cy="342.2558"
+ r="12"
+ id="circle20"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Hama / Homs"
+ cx="1132.5"
+ cy="571"
+ r="12"
+ id="circle22"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Hama / Albara"
+ cx="950.42859"
+ cy="450.0629"
+ r="12"
+ id="circle24"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Hama / Monterrand"
+ cx="963.85614"
+ cy="554.27655"
+ r="12"
+ id="circle26"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Homs / Lacum"
+ cx="979.66449"
+ cy="779.88367"
+ r="12"
+ id="circle28"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Homs / Qaddas"
+ cx="1155.5"
+ cy="780"
+ r="12"
+ id="circle30"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Homs / Monterrand"
+ cx="986"
+ cy="643"
+ r="12"
+ id="circle32"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Homs / Krak"
+ cx="926.5"
+ cy="726"
+ r="12"
+ id="circle34"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Lacum / Qaddas"
+ cx="1062.8297"
+ cy="905.73419"
+ r="12"
+ id="circle36"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Lacum / Baalbek"
+ cx="888.5"
+ cy="953"
+ r="12"
+ id="circle38"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Lacum / Krak"
+ cx="867.27191"
+ cy="793.57495"
+ r="12"
+ id="circle40"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Qaddas / Damascus"
+ cx="1170"
+ cy="1038"
+ r="12"
+ id="circle42"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Baalbek / Anjar"
+ cx="811.5"
+ cy="1081.5"
+ r="12"
+ id="circle44"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Baalbek / Tripoli"
+ cx="775.97717"
+ cy="953.27899"
+ r="12"
+ id="circle46"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Anjar / Damascus"
+ cx="868.5"
+ cy="1177"
+ r="12"
+ id="circle48"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Anjar / Beirut"
+ cx="635.32697"
+ cy="1136.762"
+ r="12"
+ id="circle50"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Anjar / Beaufort"
+ cx="717.70734"
+ cy="1197.6344"
+ r="12"
+ id="circle52"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Damascus / Banyas"
+ cx="936.24713"
+ cy="1267.1222"
+ r="12"
+ id="circle54"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Damascus / Ashtera"
+ cx="1050.5"
+ cy="1339"
+ r="12"
+ id="circle56"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Banyas / Ashtera"
+ cx="907.11737"
+ cy="1411.2574"
+ r="12"
+ id="circle58"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Banyas / Beaufort"
+ cx="666.4845"
+ cy="1389.4496"
+ r="12"
+ id="circle60"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Banyas / Tiberias"
+ cx="729.61981"
+ cy="1455.0599"
+ r="12"
+ id="circle62"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Ashtera / Ajlun"
+ cx="1046.3632"
+ cy="1490.8855"
+ r="12"
+ id="circle64"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Ajlun / Tiberias"
+ cx="910.80432"
+ cy="1553.918"
+ r="12"
+ id="circle66"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Ajlun / Amman"
+ cx="1034.8445"
+ cy="1711.1224"
+ r="12"
+ id="circle68"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="St. Simeon / Antioch"
+ cx="412"
+ cy="208"
+ r="12"
+ id="circle70"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Antioch / Harim"
+ cx="600"
+ cy="127.38018"
+ r="12"
+ id="circle72"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Antioch / Kassab"
+ cx="477.3251"
+ cy="259.52649"
+ r="12"
+ id="circle74"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Harim / Shughur"
+ cx="684.38556"
+ cy="214.05885"
+ r="12"
+ id="circle76"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Kassab / Latakia"
+ cx="405.5"
+ cy="387.5"
+ r="12"
+ id="circle78"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Shughur / Saône"
+ cx="635.02734"
+ cy="373.70758"
+ r="12"
+ id="circle80"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Shughur / Albara"
+ cx="704.05487"
+ cy="344.73975"
+ r="12"
+ id="circle82"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Latakia / Saône"
+ cx="523.5"
+ cy="432"
+ r="12"
+ id="circle84"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Latakia / Margat"
+ cx="491.5"
+ cy="487.5"
+ r="12"
+ id="circle86"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Saône / Albara"
+ cx="735"
+ cy="420.5"
+ r="12"
+ id="circle88"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Margat / Tartus"
+ cx="546.5"
+ cy="653.5"
+ r="12"
+ id="circle90"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Monterrand / Krak"
+ cx="850.96875"
+ cy="664.35345"
+ r="12"
+ id="circle92"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Tartus / Krak"
+ cx="689"
+ cy="722"
+ r="12"
+ id="circle94"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Tartus / Tripoli"
+ cx="669"
+ cy="785.5"
+ r="12"
+ id="circle96"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Krak / Tripoli"
+ cx="756.5"
+ cy="806.5"
+ r="12"
+ id="circle98"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Tripoli / Botron"
+ cx="571.41937"
+ cy="932.94006"
+ r="12"
+ id="circle100"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Botron / Beirut"
+ cx="566.5"
+ cy="1052"
+ r="12"
+ id="circle102"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Beirut / Sidon"
+ cx="503"
+ cy="1219"
+ r="12"
+ id="circle104"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Sidon / Tyre"
+ cx="460"
+ cy="1329.5"
+ r="12"
+ id="circle106"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Sidon / Beaufort"
+ cx="542"
+ cy="1323.5"
+ r="12"
+ id="circle108"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Tyre / Beaufort"
+ cx="546"
+ cy="1388"
+ r="12"
+ id="circle110"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Tyre / Acre"
+ cx="427"
+ cy="1492"
+ r="12"
+ id="circle112"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Acre / Tiberias"
+ cx="600.5"
+ cy="1571.5"
+ r="12"
+ id="circle114"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Acre / Legio"
+ cx="518"
+ cy="1652.5"
+ r="12"
+ id="circle116"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Acre / Caesarea"
+ cx="389.65146"
+ cy="1657.533"
+ r="12"
+ id="circle118"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Tiberias / Baisan"
+ cx="758.84827"
+ cy="1631.7234"
+ r="12"
+ id="circle120"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Legio / Baisan"
+ cx="653.27991"
+ cy="1684.589"
+ r="12"
+ id="circle122"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Legio / Nablus"
+ cx="619"
+ cy="1723.5"
+ r="12"
+ id="circle124"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Baisan / Nablus"
+ cx="675"
+ cy="1736"
+ r="12"
+ id="circle126"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Baisan / Damiya"
+ cx="810.5"
+ cy="1723"
+ r="12"
+ id="circle128"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Caesarea / Nablus"
+ cx="519.5"
+ cy="1776.5"
+ r="12"
+ id="circle130"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Caesarea / Jaffa"
+ cx="409"
+ cy="1836.5"
+ r="12"
+ id="circle132"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Nablus / Damiya"
+ cx="745"
+ cy="1797"
+ r="12"
+ id="circle134"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Nablus / Jerusalem"
+ cx="653"
+ cy="1883"
+ r="12"
+ id="circle136"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Damiya / Amman"
+ cx="934.28229"
+ cy="1781.4043"
+ r="12"
+ id="circle138"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Damiya / Jericho"
+ cx="845.08759"
+ cy="1883.2872"
+ r="12"
+ id="circle140"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Amman / Jericho"
+ cx="958.41956"
+ cy="1891.8888"
+ r="12"
+ id="circle142"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Amman / Kerak"
+ cx="1129.8142"
+ cy="1972.9695"
+ r="12"
+ id="circle144"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Jaffa / Ramallah"
+ cx="463"
+ cy="1932"
+ r="12"
+ id="circle146"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Jaffa / Ascalon"
+ cx="390.88397"
+ cy="2003.7799"
+ r="12"
+ id="circle148"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Ramallah / Jerusalem"
+ cx="586"
+ cy="1971.5"
+ r="12"
+ id="circle150"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Ramallah / Ascalon"
+ cx="448"
+ cy="2014"
+ r="12"
+ id="circle152"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Jerusalem / Jericho"
+ cx="789.3551"
+ cy="1954.4401"
+ r="12"
+ id="circle154"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Jerusalem / Hebron"
+ cx="677.30878"
+ cy="2050.4141"
+ r="12"
+ id="circle156"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Jericho / Kerak"
+ cx="951.5"
+ cy="1975.5"
+ r="12"
+ id="circle158"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Ascalon / Lachish"
+ cx="439.29956"
+ cy="2128.4792"
+ r="12"
+ id="circle160"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Ascalon / Gaza"
+ cx="330.43219"
+ cy="2133.1641"
+ r="12"
+ id="circle162"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Lachish / Hebron"
+ cx="556.32245"
+ cy="2150.7788"
+ r="12"
+ id="circle164"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Lachish / Gaza"
+ cx="429.73749"
+ cy="2172.2603"
+ r="12"
+ id="circle166"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Hebron / Dimona"
+ cx="658.28107"
+ cy="2241.6177"
+ r="12"
+ id="circle168"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Hebron / Zoar"
+ cx="779.01019"
+ cy="2195.3918"
+ r="12"
+ id="circle170"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Kerak / Zoar"
+ cx="998.22845"
+ cy="2139.8015"
+ r="12"
+ id="circle172"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Gaza / Beersheba"
+ cx="369"
+ cy="2265"
+ r="12"
+ id="circle174"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Gaza / Egypt"
+ cx="225.37711"
+ cy="2266.1133"
+ r="12"
+ id="circle176"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Beersheba / Dimona"
+ cx="538.5"
+ cy="2293"
+ r="12"
+ id="circle178"
+ style="opacity:0.49443174" />
+ <circle
+ inkscape:label="Beersheba / Egypt"
+ cx="414.74786"
+ cy="2311.9475"
+ r="12"
+ id="circle180"
+ style="opacity:0.494432" />
+ <circle
+ inkscape:label="Dimona / Zoar"
+ cx="788"
+ cy="2290.5"
+ r="12"
+ id="circle182"
+ style="opacity:0.49443174" />
+</svg>