summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui.js b/ui.js
index 6e192a1..4629578 100644
--- a/ui.js
+++ b/ui.js
@@ -181,7 +181,7 @@ function build_map() {
element.classList.add("block_"+block.label);
element.addEventListener("mouseenter", on_focus_block);
element.addEventListener("mouseleave", on_blur_block);
- element.addEventListener("click", select_block);
+ element.addEventListener("click", on_click_map_block);
document.getElementById("known_blocks").appendChild(element);
element.style.visibility = 'hidden';
element.block = b;
@@ -222,7 +222,7 @@ function build_map() {
element.classList.add("block_"+block.label);
element.addEventListener("mouseenter", on_focus_battle_block);
element.addEventListener("mouseleave", on_blur_battle_block);
- element.addEventListener("click", select_block);
+ element.addEventListener("click", on_click_battle_block);
element.block = b;
ui.battle_block[b] = element;
@@ -732,10 +732,15 @@ function select_space(evt) {
send_action('space', evt.target.space);
}
-function select_block(evt) {
+function on_click_battle_block(evt) {
send_action('block', evt.target.block);
}
+function on_click_map_block(evt) {
+ if (!game.battle)
+ send_action('block', evt.target.block);
+}
+
function select_secret_block(evt) {
let element = evt.target;
let owner = null;