summaryrefslogtreecommitdiff
path: root/tools/gendata.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-01-18 13:28:02 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:39 +0100
commit26073215b9a279d3ea77274143da385615dd8a65 (patch)
treee7f2bf59efb4d458807b03a796818aae9da7505f /tools/gendata.js
parente73f785e5353c5b7b0fc437c8ce2cbbc82adbd1e (diff)
downloadnevsky-26073215b9a279d3ea77274143da385615dd8a65.tar.gz
2E supply rules.
Only show Supply button if supply is possible. Smarter Lodya when Novgorod is in enemy hands.
Diffstat (limited to 'tools/gendata.js')
-rw-r--r--tools/gendata.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index c671cf6..05ac486 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -5,6 +5,7 @@
const fs = require('fs')
function cmpnum(a,b) { return a - b }
+function cmpnum2(a,b) { return a[0] - b[0] }
// :r !python3 genboxes.py
const boxes = {
@@ -307,24 +308,33 @@ locales.forEach(loc => {
loc.adjacent = []
loc.adjacent_by_trackway = []
loc.adjacent_by_waterway = []
+ loc.trackways = []
+ loc.waterways = []
for (let data of loc.ways) {
let to = data[0]
for (let i = 1; i < data.length; ++i) {
let way = data[i]
- console.log("WAY", loc.name, to, way)
if (!loc.adjacent.includes(to))
loc.adjacent.push(to)
- if (ways[way].type === "trackway")
- if (!loc.adjacent_by_trackway.includes(to))
+ if (ways[way].type === "trackway") {
+ if (!loc.adjacent_by_trackway.includes(to)) {
loc.adjacent_by_trackway.push(to)
- if (ways[way].type === "waterway")
- if (!loc.adjacent_by_waterway.includes(to))
+ loc.trackways.push([to,way])
+ }
+ }
+ if (ways[way].type === "waterway") {
+ if (!loc.adjacent_by_waterway.includes(to)) {
loc.adjacent_by_waterway.push(to)
+ loc.waterways.push([to,way])
+ }
+ }
}
}
loc.adjacent.sort(cmpnum)
loc.adjacent_by_trackway.sort(cmpnum)
loc.adjacent_by_waterway.sort(cmpnum)
+ loc.trackways.sort(cmpnum2)
+ loc.trackways.sort(cmpnum2)
})
function seats(list) {