From 5b3e18ac67bd606395f53c096c78385d4584a039 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 14 Dec 2022 19:33:41 +0100 Subject: Raiders. --- tools/gendata.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/gendata.js b/tools/gendata.js index d9bf342..11623b0 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -4,6 +4,8 @@ const fs = require('fs') +function cmpnum(a,b) { return a - b } + // :r !python3 genboxes.py const boxes = { "Wesenberg": [1448,3625,304,60], @@ -301,6 +303,20 @@ function dumplist(name, list) { print("],") } +locales.forEach(loc => { + loc.adjacent = [] + loc.adjacent_by_trackway = [] + for (let [to, way] of loc.ways) { + if (!loc.adjacent.includes(to)) + loc.adjacent.push(to) + if (ways[way].type === "trackway") + if (!loc.adjacent_by_trackway.includes(to)) + loc.adjacent_by_trackway.push(to) + } + loc.adjacent.sort(cmpnum) + loc.adjacent_by_trackway.sort(cmpnum) +}) + function seats(list) { return list.split(", ").map(name => locmap[name]).sort((a,b)=>a-b) } @@ -589,8 +605,6 @@ let lords = [ let AOW = {} let cards = [] -function cmpnum(a,b) { return a - b } - function arts_of_war_event(name, event, when) { let c = { name, event, when, capability: null, this_lord: false, lords: null } cards.push(c) -- cgit v1.2.3