diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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) |