summaryrefslogtreecommitdiff
path: root/ui.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-24 14:01:24 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:38 +0100
commita6f5d220f496829911ac3011cdbbcc045f057b63 (patch)
tree0e34ba679ac16718652f1b9571be94b0e66f344c /ui.js
parentcbc1f4048a69dfe12ef16a63195d5a6088720495 (diff)
downloadcrusader-rex-a6f5d220f496829911ac3011cdbbcc045f057b63.tar.gz
crusader: Many fixes.
Diffstat (limited to 'ui.js')
-rw-r--r--ui.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/ui.js b/ui.js
index 6c99613..4930ce7 100644
--- a/ui.js
+++ b/ui.js
@@ -226,6 +226,7 @@ function on_click_card(evt) {
function on_button_next(evt) { send_action('next'); }
function on_button_pass(evt) { send_action('pass'); }
function on_button_undo(evt) { send_action('undo'); }
+function on_button_winter_campaign(evt) { send_action('winter_campaign'); }
function on_button_group_move(evt) { send_action('group_move'); }
function on_button_end_group_move(evt) { send_action('end_group_move'); }
function on_button_sea_move(evt) { send_action('sea_move'); }
@@ -590,8 +591,16 @@ function update_map() {
known = "";
element.classList = info.owner + known + " block" + image + steps + moved;
} else {
- let besieging = (game.sieges[town] == info.owner) ? " besieging" : "";
- let jihad = (game.jihad == town) ? " jihad" : "";
+ let besieging = "";
+ if (game.sieges[town] == info.owner) {
+ if (game.winter_campaign == town)
+ besieging = " winter_campaign";
+ else
+ besieging = " besieging";
+ }
+ let jihad = "";
+ if (game.jihad == town && info.owner == game.p1)
+ jihad = " jihad";
element.classList = info.owner + " block" + moved + besieging + jihad;
}
if (info.owner == FRANKS)
@@ -626,10 +635,8 @@ function update_map() {
if (game.who)
ui.blocks[game.who].classList.add('selected');
}
- for (let b of game.castle) {
+ for (let b of game.castle)
ui.blocks[b].classList.add('castle');
- ui.battle_block[b].classList.add('castle');
- }
}
function update_card_display(element, card, prior_card) {
@@ -790,6 +797,7 @@ function on_update() {
show_action_button("#next_button", "next");
show_action_button("#pass_button", "pass");
show_action_button("#undo_button", "undo");
+ show_action_button("#winter_campaign_button", "winter_campaign");
show_action_button("#group_move_button", "group_move");
show_action_button("#end_group_move_button", "end_group_move");
show_action_button("#sea_move_button", "sea_move");