summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js26
1 files changed, 19 insertions, 7 deletions
diff --git a/play.js b/play.js
index 7b38c9a..c2a49da 100644
--- a/play.js
+++ b/play.js
@@ -173,6 +173,10 @@ function is_hex_action(hex) {
return !!(view.actions && view.actions.hex && view.actions.hex.includes(hex))
}
+function is_hex_forced_march_action(hex) {
+ return !!(view.actions && view.actions.forced_march && view.actions.forced_march.includes(hex))
+}
+
function is_hex_axis_supply(hex) {
return view.axis_supply[hex] > 0
}
@@ -232,6 +236,8 @@ function on_click_hex(evt) {
hide_supply()
if (send_action('hex', evt.target.hex))
evt.stopPropagation()
+ if (send_action('forced_march', evt.target.hex))
+ evt.stopPropagation()
}
}
@@ -373,13 +379,18 @@ function build_hexes() {
}
function add_hex(x, y) {
+ let sm_hex_w = hex_w - 8
+ let sm_hex_h = sm_hex_w / sqrt(3) * 2
+ let ww = sm_hex_w / 2
+ let aa = sm_hex_h / 2
+ let bb = sm_hex_h / 4
return [
- [ round(x), round(y-a) ],
- [ round(x+w), round(y-b) ],
- [ round(x+w), round(y+b) ],
- [ round(x), round(y+a) ],
- [ round(x-w), round(y+b) ],
- [ round(x-w), round(y-b) ]
+ [ round(x), round(y-aa) ],
+ [ round(x+ww), round(y-bb) ],
+ [ round(x+ww), round(y+bb) ],
+ [ round(x), round(y+aa) ],
+ [ round(x-ww), round(y+bb) ],
+ [ round(x-ww), round(y-bb) ]
].join(" ")
}
@@ -519,7 +530,8 @@ function update_map() {
}
if (ui.hexes[hex]) {
- ui.hexes[hex].classList.toggle("action", is_hex_action(hex))
+ ui.hexes[hex].classList.toggle("action", is_hex_action(hex) || is_hex_forced_march_action(hex))
+ ui.hexes[hex].classList.toggle("forced_march", is_hex_forced_march_action(hex))
ui.hexes[hex].classList.toggle("from", hex === view.from1 || hex === view.from2)
ui.hexes[hex].classList.toggle("to", hex === view.to1 || hex === view.to2)
ui.hexes[hex].classList.toggle("axis_control", is_hex_axis_controlled(hex))