summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-07-31 13:32:52 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 13:11:26 +0100
commit3e2b722afd1fc09cc242ea8aaa59f75f7a6a8605 (patch)
treed1f517fdb579fb4e04b9d6cf3c90b7fce7008982 /play.js
parent23882805614d548df2d4c5aecfbcb40438868207 (diff)
downloadrommel-in-the-desert-3e2b722afd1fc09cc242ea8aaa59f75f7a6a8605.tar.gz
Show active/assault battle hexes.
Diffstat (limited to 'play.js')
-rw-r--r--play.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/play.js b/play.js
index a424ad8..2590254 100644
--- a/play.js
+++ b/play.js
@@ -230,6 +230,18 @@ function is_side_allied_supply_line(side) {
return view.allied_supply_line[side] > 0
}
+function is_hex_battle(hex) {
+ return set_has(view.battles, hex) && !set_has(view.assaults)
+}
+
+function is_hex_assault(hex) {
+ return set_has(view.assaults, hex)
+}
+
+function is_hex_current(hex) {
+ return hex === view.pursuit || hex === view.battle
+}
+
function focus_stack(stack) {
if (ui.focus !== stack) {
console.log("FOCUS STACK", stack)
@@ -698,6 +710,9 @@ function update_map() {
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("battle", is_hex_battle(hex))
+ ui.hexes[hex].classList.toggle("assault", is_hex_assault(hex))
+ ui.hexes[hex].classList.toggle("current", is_hex_current(hex))
ui.hexes[hex].classList.toggle("axis_control", is_hex_axis_controlled(hex))
ui.hexes[hex].classList.toggle("allied_control", is_hex_allied_controlled(hex))
for (let s = 0; s < 3; ++s) {
@@ -736,7 +751,7 @@ function update_battle_line(hex, line, test) {
e.classList.toggle("action", is_unit_action(u))
e.classList.toggle("selected", is_unit_selected(u))
e.classList.toggle("disrupted", is_unit_disrupted(u))
- e.classList.toggle("fire", is_unit_fired(u))
+ e.classList.toggle("moved", is_unit_fired(u))
e.classList.toggle("revealed", is_unit_revealed(u))
} else {
if (line.contains(e))