summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gendata.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/gendata.js b/tools/gendata.js
index 8ee858a..fb64009 100644
--- a/tools/gendata.js
+++ b/tools/gendata.js
@@ -31,6 +31,7 @@ let hex_exists = new Array(map_w*map_h).fill(1);
let side_limit = new Array(map_w*map_h*3).fill(CLEAR);
let side_road = new Array(map_w*map_h*3).fill(0);
let hex_road = new Array(map_w*map_h).fill(0);
+let hex_all_road = new Array(map_w*map_h).fill(0);
function add_side(s, t) {
if (side_limit[s])
@@ -57,9 +58,11 @@ function def_side(t,a,b) {
}
function def_road(t, list) {
- for (let i = 0; i < list.length; ++i)
+ for (let i = 0; i < list.length; ++i) {
+ hex_all_road[list[i]] |= t;
if (t > hex_road[list[i]])
hex_road[list[i]] = t;
+ }
for (let i = 1; i < list.length; ++i) {
let s = to_side_id(list[i-1], list[i]);
side_road[s] = t;
@@ -652,6 +655,7 @@ let data = "// DON'T EDIT - AUTOGENERATED\n"
data += "const all_hexes = " + JSON.stringify(all_hexes) + "\n"
data += "const hex_exists = " + JSON.stringify(hex_exists) + "\n"
data += "const hex_road = " + JSON.stringify(hex_road) + "\n"
+data += "const hex_all_road = " + JSON.stringify(hex_all_road) + "\n"
data += "const side_road = " + JSON.stringify(side_road) + "\n"
data += "const side_limit = " + JSON.stringify(side_limit) + "\n"
data += "const hex_name = " + JSON.stringify(hex_name) + "\n"
@@ -665,7 +669,7 @@ gen_array("unit_class", u => u.class)
gen_array("unit_speed", u => u.speed)
data += "if (typeof module !== 'undefined')\n\tmodule.exports = {\n"
-data += "\t\tall_hexes, hex_exists, hex_name, hex_road, side_road, side_limit, regions,\n"
+data += "\t\tall_hexes, hex_exists, hex_name, hex_all_road, hex_road, side_road, side_limit, regions,\n"
data += "\t\tunit_name, unit_appearance, unit_max_steps, unit_elite, unit_class, unit_speed,\n"
data += "\t}\n"