summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-02-01 21:39:35 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:39 +0100
commit6fc4d02d7d171b90e880468fc5e51072e4e4a346 (patch)
tree06f5295429104b74e0b69270c5cbba9a6ab44242 /play.js
parentee193334e466bb4b62bcec03e7cc5b0a7b264876 (diff)
downloadnevsky-6fc4d02d7d171b90e880468fc5e51072e4e4a346.tar.gz
Manual strikes.
Diffstat (limited to 'play.js')
-rw-r--r--play.js12
1 files changed, 12 insertions, 0 deletions
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)