summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-09-26 12:45:48 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-09-26 12:45:48 +0200
commita466d9b396dd1365ab66f0e9d32afce96707acfd (patch)
treec0d587b4e5685ee0edfb6f063ead83ba083b65c2 /tools
parent70a999fe850469b4769265005bd93003634f0dd8 (diff)
downloadalgeria-a466d9b396dd1365ab66f0e9d32afce96707acfd.tar.gz
generate unit consts
Diffstat (limited to 'tools')
-rw-r--r--tools/gendata.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index 0f49c71..75c7348 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -84,6 +84,7 @@ def_area("Sidi Aissa", REMOTE, "VI", 1385, 1186)
def_area("Ain Qussera", RURAL, "VI", 1070.6, 1235.6)
+// XXX not sure about this
let free_deploy_locations = []
for (let l of ["I", "II", "III", "IV", "V", "VI"]) {
free_deploy_locations.push(locations[l])
@@ -137,14 +138,18 @@ def_unit(GOV, EL_X, "fr_elite_x_marine", 3)
def_unit(GOV, AL_X, "alg_x", 6)
def_unit(GOV, POL, "alg_police", 10)
-console.log("last_gov_unit =", units.length)
def_unit(FLN, FAILEK, "fln_failek", 10)
def_unit(FLN, BAND, "fln_band", 24)
def_unit(FLN, CADRE, "fln_cadre", 30)
def_unit(FLN, FRONT, "fln_front", 16)
-console.log("unit_count =", units.length)
+console.log("const unit_count =", units.length)
+console.log("const first_gov_unit =", units.findIndex((u) => u.side === GOV))
+console.log("const last_gov_unit =", units.findLastIndex((u) => u.side === GOV))
+console.log("const first_fln_unit =", units.findIndex((u) => u.side === FLN))
+console.log("const last_fln_unit =", units.findLastIndex((u) => u.side === FLN))
+
data.units = units
fs.writeFileSync("data.js", "const data = " + JSON.stringify(data, 0, 0) + "\nif (typeof module !== 'undefined') module.exports = data\n")