From 2376a8b9640fe3ff92bfbfb3c97a5791013b48d7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 8 Sep 2022 20:15:46 +0200 Subject: Name all hexes. --- tools/gendata.js | 85 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 35 deletions(-) (limited to 'tools') diff --git a/tools/gendata.js b/tools/gendata.js index 1b0c85b..492e7f2 100644 --- a/tools/gendata.js +++ b/tools/gendata.js @@ -25,7 +25,7 @@ const map_h = 9; let next = [ 1, map_w, map_w-1, -1, -map_w, -(map_w-1) ]; let nextdir = [ -1, 1, map_w, map_w-1, -map_w, -(map_w-1) ] -let nextname = [ "E", "W", "NW", "NE", "SE", "SW" ]; +let nextname = [ "W", "E", "SE", "SW", "NW", "NE" ]; let hex_exists = new Array(map_w*map_h).fill(1); let side_limit = new Array(map_w*map_h*3).fill(CLEAR); @@ -252,7 +252,7 @@ def_offmap(214,221); // Qattara Depression and east of it // def_offmap(145,148); -def_offmap(145,146); +def_offmap(145,147); def_offmap(168,172); def_offmap(192,196); def_offmap(216,221); @@ -299,20 +299,6 @@ def_region("West Line", 103, 107); def_region("West Line", 128, 130); def_region("West Line", 151, 152); -// def_region("Jebel el Akhdar", 7, 9); -// def_region("Jebel el Akhdar", 32, 34); -// def_region("Jebel el Akhdar", 56, 57); - -// def_region("Sebkha el Segira", 152, 152); -// def_region("Sebkha el Segira", 176, 176); -// def_region("Sebket el Jeneinen", 179, 179); -// def_region("Sebket el Jeneinen", 203, 203); - -// def_region("Qattara Depression", 144, 146); -// def_region("Qattara Depression", 168, 169); -// def_region("Qattara Depression", 192, 193); -// def_region("Qattara Depression", 216, 217); - hex_name = { 7: "El Garib", 8: "Cyrene", @@ -389,10 +375,6 @@ hex_name = { 204: "Jalo Oasis", 213: "Siwa Oasis", - // overrides - 123: "El Himeimat E E", - 147: "El Himeimat E SE", - 99: "Map Edge", 148: "Map Edge", 197: "Map Edge", @@ -402,26 +384,59 @@ hex_name = { 49: "Alexandria Queue", 102: "Return for Refit", 127: "El Agheila Queue", + + 164: "Siwa Oasis NE NW", + 123: "Alexandria SW SE", } -function expand_names() { - let hex_name2 = { } - for (let hex_id = 0; hex_id < map_w * map_h; ++hex_id) { - if (hex_exists[hex_id] && !hex_name[hex_id]) { - for (let s = 0; s < 6; ++s) { - let next_id = hex_id + nextdir[s]; - if (hex_name[next_id]) { - hex_name2[hex_id] = hex_name[next_id] + " " + nextname[s]; - break; - } - } - } +function nameregion(name, region) { + for (let x of region) + if (!(x in hex_name) && hex_exists[x]) + hex_name[x] = name +} + +function namearound(name) { + let hex_id = 0 + for (let x in hex_name) + if (hex_name[x] === name) + hex_id = x | 0 + if (hex_id === 0) + throw new Error("place not found: " + name) + for (let s = 0; s < 6; ++s) { + let next_id = hex_id + nextdir[s]; + if (hex_exists[next_id] && hex_name[next_id] === undefined) + hex_name[next_id] = name + " " + nextname[s] } - for (let hex_id in hex_name2) - hex_name[hex_id] = hex_name2[hex_id]; } -expand_names(); +namearound("Jalo Oasis") +namearound("Jarabub Oasis") +namearound("Siwa Oasis") + +namearound("Maaten Giofer") +namearound("Mersa Matruh") +namearound("Bir el Kenayis") +namearound("Msus") +namearound("Derna") +namearound("Mechili") +namearound("Tengeder") +namearound("Haraga") +namearound("Ft. Maddalena") +namearound("Bir Hacheim") +namearound("Bir Gubi") +namearound("Alexandria") +namearound("El Alamein") +namearound("Fuka") +namearound("El Himeimat") +namearound("Bir Khamsa") +namearound("Bir Fuad") + +nameregion("Western Desert", [119, 143, 144, 167, 190, 191 ]) +nameregion("Qattara Depression", [ 144, 145, 146, 147, 167, 168, 169, 191, 192, 193, 215, 216, 217 ]) +nameregion("Jalo Oasis Trail", [ 157, 133, 181 ]) +nameregion("Libya Trail", [ 182, 183, 184, 185 ]) +nameregion("Libya", regions.Libya) +nameregion("Egypt", regions.Egypt) let units = []; -- cgit v1.2.3