From 39da77aa0351b2c207310acc3eb5b20450019b70 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 10 Jan 2023 12:49:55 +0100 Subject: Fix adjacency data with multiple ways between same locales. --- tools/gendata.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/gendata.js b/tools/gendata.js index 0a1f5b4..c671cf6 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -307,15 +307,20 @@ locales.forEach(loc => { loc.adjacent = [] loc.adjacent_by_trackway = [] loc.adjacent_by_waterway = [] - 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) - if (ways[way].type === "waterway") - if (!loc.adjacent_by_waterway.includes(to)) - loc.adjacent_by_waterway.push(to) + 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)) + loc.adjacent_by_trackway.push(to) + if (ways[way].type === "waterway") + if (!loc.adjacent_by_waterway.includes(to)) + loc.adjacent_by_waterway.push(to) + } } loc.adjacent.sort(cmpnum) loc.adjacent_by_trackway.sort(cmpnum) -- cgit v1.2.3