From bbcc4798c959efe9a0056da85224409c418dec9d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 30 Sep 2023 00:47:39 +0200 Subject: Add village names as HTML text. --- tools/labels.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/labels.js (limited to 'tools/labels.js') diff --git a/tools/labels.js b/tools/labels.js new file mode 100644 index 0000000..c739825 --- /dev/null +++ b/tools/labels.js @@ -0,0 +1,31 @@ +const data = require('../data.js') + +const yoff = 1555 +const xoff = 36 +const hex_dx = 58.67 +const hex_dy = 68 +const hex_r = 56 >> 1 + +const CAPS = [ 1204, 1217, 1737, 2911, 3002, 3925 ] + +var hex_x = [] +var hex_y = [] + +for (let row = 0; row < data.map.rows; ++row) { + for (let col = 0; col < data.map.cols; ++col) { + let hex_id = 1000 + 100 * row + col + hex_x[hex_id] = Math.floor(xoff + hex_dx * (col + (row & 1) * 0.5 + 0.5)) + hex_y[hex_id] = Math.floor(yoff - hex_dy * 3 / 4 * row + hex_dy/2) + } +} + +for (let hex in data.map.names) { + hex = hex | 0 + let name = data.map.names[hex] + let x = hex_x[hex] - 35 + let y = hex_y[hex] + if (CAPS.includes(hex)) + console.log(`
${name}
`) + else + console.log(`
${name}
`) +} -- cgit v1.2.3