summaryrefslogtreecommitdiff
path: root/tools/gendata.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-07-09 00:38:57 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:25 +0100
commit0bd59a6223df84916f766f1fcccc4439e92efc8e (patch)
tree947d6e79f58690196ea9984f189c69695e759a09 /tools/gendata.js
parent68d249e1cff4b1638e4eefa463f3a680ffd62d6c (diff)
downloadrommel-in-the-desert-0bd59a6223df84916f766f1fcccc4439e92efc8e.tar.gz
firing and taking hits
Diffstat (limited to 'tools/gendata.js')
-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";