summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gendata.js31
1 files changed, 18 insertions, 13 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index 75c3a9f..a4fb97c 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -410,18 +410,23 @@ expand_names();
let units = [];
+const ARMOR = 0
+const INFANTRY = 1
+const ANTITANK = 2
+const ARTILLERY = 3
+
const class_from_type = {
- "recon": "armor",
- "armor": "armor",
- "i-tank": "armor",
- "infantry": "infantry",
- "mech. inf.": "infantry",
- "mot. inf.": "infantry",
- "para": "infantry",
- "mob. a/t": "antitank",
- "mot. a/t": "antitank",
- "self prop. arty": "artillery",
- "artillery": "artillery",
+ "recon": ARMOR,
+ "armor": ARMOR,
+ "i-tank": ARMOR,
+ "infantry": INFANTRY,
+ "mech. inf.": INFANTRY,
+ "mot. inf.": INFANTRY,
+ "para": INFANTRY,
+ "mob. a/t": ANTITANK,
+ "mot. a/t": ANTITANK,
+ "self prop. arty": ARTILLERY,
+ "artillery": ARTILLERY,
}
const speed_from_type = {
@@ -441,12 +446,12 @@ const speed_from_type = {
let unit_map = {};
function def_block(nationality, type, appearance, steps, elite, label, name) {
- let type_class = class_from_type[type];
+ let klass = class_from_type[type];
let speed = speed_from_type[type];
if (name in unit_map)
throw new Error("duplicate block name:", name);
unit_map[name] = units.length;
- units.push({nationality, type, class: type_class, speed, appearance, steps, elite, label, name});
+ units.push({nationality, type, class: klass, speed, appearance, steps, elite, label, name});
}
let S = "S";