diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-07-31 13:32:52 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-17 13:11:26 +0100 |
commit | 3e2b722afd1fc09cc242ea8aaa59f75f7a6a8605 (patch) | |
tree | d1f517fdb579fb4e04b9d6cf3c90b7fce7008982 /play.js | |
parent | 23882805614d548df2d4c5aecfbcb40438868207 (diff) | |
download | rommel-in-the-desert-3e2b722afd1fc09cc242ea8aaa59f75f7a6a8605.tar.gz |
Show active/assault battle hexes.
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -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)) |