summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-10-25 18:56:40 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-26 13:03:44 +0200
commitefe7923ebe128ae76cfa597c8e89cd6199a5cab6 (patch)
tree09e49d432fe40d3a4d3f86e245646e330944e419 /play.js
parent2dadb8de216a3fd46a8f692c66f03336c4f71d00 (diff)
downloadwaterloo-campaign-1815-efe7923ebe128ae76cfa597c8e89cd6199a5cab6.tar.gz
Fix forbidden hex lists and label which overlay is visible.
Diffstat (limited to 'play.js')
-rw-r--r--play.js30
1 files changed, 20 insertions, 10 deletions
diff --git a/play.js b/play.js
index b4ff74c..9dc7f40 100644
--- a/play.js
+++ b/play.js
@@ -16,6 +16,20 @@ const DICE = {
D6: '<span class="dice d6"></span>',
}
+const FORBIDDEN = [
+ [
+ 2800, 2801, 2900, 2901, 3000, 3001, 3002, 3040, 3041,
+ 3100, 3101, 3139, 3140, 3141, 3200, 3201, 3239, 3240,
+ 3241, 3339, 3340, 3341, 3440, 3441, 3814, 3815, 3816,
+ 3913, 3914, 3915, 3916, 4013, 4014, 4015, 4016, 4017,
+ ],
+ [
+ 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021,
+ 1022, 1114, 1115, 1116, 1117, 1120, 1121, 1215, 1216,
+ 1218, 1221,
+ ],
+]
+
const yoff = 1555
const xoff = 36
const hex_dx = 58.67
@@ -184,6 +198,11 @@ for (let row = 0; row < data.map.rows; ++row) {
else
hex.my_name = String(hex_id)
+ if (set_has(FORBIDDEN[0], hex_id))
+ hex.classList.add("p1forbidden")
+ if (set_has(FORBIDDEN[1], hex_id))
+ hex.classList.add("p2forbidden")
+
document.getElementById("hexes").appendChild(hex)
}
}
@@ -209,16 +228,7 @@ function toggle_pieces() {
function toggle_hexes() {
// Cycle between showing nothing, command ranges, and zocs
let elt = document.getElementById("hexes")
- if (elt.className == "")
- elt.className = "p1hq"
- else if (elt.className == "p1hq")
- elt.className = "p2hq"
- else if (elt.className == "p2hq")
- elt.className = "p1zoc"
- else if (elt.className == "p1zoc")
- elt.className = "p2zoc"
- else if (elt.className == "p2zoc")
- elt.className = ""
+ elt.dataset.show = ((elt.dataset.show|0) + 1) % 5
}
function is_action(action, arg) {