From 0bd59a6223df84916f766f1fcccc4439e92efc8e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 9 Jul 2022 00:38:57 +0200 Subject: firing and taking hits --- tools/gendata.js | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'tools') 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"; -- cgit v1.2.3