From 26073215b9a279d3ea77274143da385615dd8a65 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 18 Jan 2023 13:28:02 +0100 Subject: 2E supply rules. Only show Supply button if supply is possible. Smarter Lodya when Novgorod is in enemy hands. --- tools/gendata.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'tools/gendata.js') 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) { -- cgit v1.2.3