From 2d66908b20d43a39974f99a0ec74212eaa5031ed Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 5 Mar 2023 20:34:55 +0100 Subject: Patrol, Sweep & Assault. TODO: LimOp Patrol - only move to one destination. --- tools/gendata.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/gendata.js b/tools/gendata.js index 4fd79a2..4d773e9 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -156,7 +156,7 @@ function def_loc(type, econ, cities, depts) { console.log("not a space: " + n) let loc_spaces = loc_names.map(n => space_name.indexOf(n)) let ix = spaces.length - spaces.push({ type, id: to_ascii(name), econ, adjacent: loc_spaces.filter(x=>x>0) }) + spaces.push({ type, id: to_ascii(name), econ, adjacent: loc_spaces.filter(x => x >= 0) }) for (let loc of loc_spaces) if (loc >= 0) add(spaces[loc].adjacent, ix) @@ -414,6 +414,14 @@ data.card_order = card_order data.space_name = space_name data.spaces = spaces +data.adjacent_patrol = [] +for (let s = 0; s < spaces.length; ++s) { + let ap = data.adjacent_patrol[s] = [] + for (let next of spaces[s].adjacent) + if ((next <= data.last_city) || (next >= data.first_loc && next <= data.last_loc)) + ap.push(next) +} + let pc_index = 0 let pc_first = data.first_piece = [ [ 0, 0, 0, 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ] let pc_last = data.last_piece = [ [ -1, -1, -1, -1, -1 ], [ -1, -1 ], [ -1, -1 ], [ -1, -1 ] ] -- cgit v1.2.3