From 6fc4d02d7d171b90e880468fc5e51072e4e4a346 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 1 Feb 2023 21:39:35 +0100 Subject: Manual strikes. --- play.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'play.js') diff --git a/play.js b/play.js index ad5a7ba..c270365 100644 --- a/play.js +++ b/play.js @@ -321,6 +321,10 @@ function is_veche_action() { return !!(view.actions && view.actions.veche === 1) } +function is_garrison_action() { + return !!(view.actions && view.actions.garrison === 1) +} + function is_calendar_action(turn) { return !!(view.actions && view.actions.calendar && set_has(view.actions.calendar, turn)) } @@ -824,6 +828,11 @@ function on_click_array(evt) { send_action('array', evt.target.my_id) } +function on_click_garrison(evt) { + if (evt.button === 0) + send_action('garrison') +} + function on_blur(evt) { document.getElementById("status").textContent = "" } @@ -1619,6 +1628,7 @@ function update_battle() { } ui.garrison.classList.toggle("hide", !view.battle.storm) + ui.garrison.classList.toggle("action", is_garrison_action()) ui.garrison.replaceChildren() if (view.battle.garrison) { @@ -2164,6 +2174,8 @@ function build_map() { build_plan() + ui.garrison.addEventListener("mousedown", on_click_garrison) + for (let i = 0; i < 12; ++i) { ui.battle_grid_array[i].my_id = i ui.battle_grid_array[i].addEventListener("mousedown", on_click_array) -- cgit v1.2.3