summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-22 15:14:41 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:38 +0100
commitc7856fc54d20e88f53adb72d93cd89a6045a2f1e (patch)
treed040bc7139d818af541a781e5cddf94c7d4bec7e /ui.js
parent880049b3d4f7aa57e16633684f0a1f1519087339 (diff)
downloadcrusader-rex-c7856fc54d20e88f53adb72d93cd89a6045a2f1e.tar.gz
crusader: Fix battle screen tooltips.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/ui.js b/ui.js
index e9c1d11..71b0846 100644
--- a/ui.js
+++ b/ui.js
@@ -102,20 +102,18 @@ function on_click_map_block(evt) {
send_action('block', b);
}
-function is_battle_reserve(who, list) {
- for (let [b, s, m] of list)
- if (who == b)
- return true;
- return false;
-}
-
function on_focus_battle_block(evt) {
let b = evt.target.block;
- let msg = block_name(b);
- if (is_battle_reserve(b, game.battle.FR))
- msg = "Frank Reserve";
- if (is_battle_reserve(b, game.battle.SR))
- msg = "Saracen Reserve";
+ let msg;
+
+ if (!evt.target.classList.contains("known")) {
+ if (block_owner(b) == FRANKS)
+ msg = "Franks";
+ else if (block_owner(b) == SARACENS)
+ msg = "Saracens";
+ } else {
+ msg = block_name(b);
+ }
if (game.actions && game.actions.battle_fire && game.actions.battle_fire.includes(b))
msg = "Fire with " + msg;
@@ -123,6 +121,8 @@ function on_focus_battle_block(evt) {
msg = "Storm with " + msg;
else if (game.actions && game.actions.battle_sally && game.actions.battle_sally.includes(b))
msg = "Sally with " + msg;
+ else if (game.actions && game.actions.battle_withdraw && game.actions.battle_withdraw.includes(b))
+ msg = "Withdraw with " + msg;
else if (game.actions && game.actions.battle_hit && game.actions.battle_hit.includes(b))
msg = "Take hit on " + msg;