diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 55 |
1 files changed, 26 insertions, 29 deletions
@@ -1,8 +1,11 @@ "use strict" // vim: set nowrap: -/* globals data, view, action_button, action_button_with_argument, confirm_action_button, send_action, params -*/ +/* globals + * data, political_cards, view + * action_button, action_button_with_argument, confirm_action_button, send_action, scroll_into_view, send_message + * params, roles, game_cookie + */ // TODO: animate_position on pieces instead of top/left transition // TODO: animate_position on political markers instead of top/left transition @@ -36,12 +39,6 @@ function action_menu_item(action) { } } -function action_menu(menu, action_list) { - let x = 0 - for (let action of action_list) - x |= action_menu_item(action) -} - const R_LOUIS_XV = "Louis XV" const R_FREDERICK = "Frederick" const R_MARIA_THERESA = "Maria Theresa" @@ -1254,8 +1251,10 @@ function layout_victory_pool(pow, max, x, y) { } if (n > max) { ui.missing[pow].textContent = "overfulfilled\n" + (n-max) + ui.missing[pow].className = "missing" } else { ui.missing[pow].textContent = "" + ui.missing[pow].className = "hide" } for (let i = 0; i < m; ++i) { let e = ui.victory[pow][used_victory[pow]++] @@ -1612,12 +1611,10 @@ function on_update() { } window.subsidy_menu.classList.toggle("hide", is_intro()) - action_menu(window.subsidy_menu, [ - "propose_subsidy", - "cancel_subsidy", - "propose_deal", - "ping", - ]) + action_menu_item("propose_subsidy") + action_menu_item("cancel_subsidy") + action_menu_item("propose_deal") + action_menu_item("ping") update_subsidy_list(view.contracts, window.subsidy_list, "Active Subsidies") update_deal_list(view.deals, window.active_deal_list, "Active Deals") @@ -1715,20 +1712,20 @@ function on_update() { /* LOG */ -function sub_political(match, p1) { +function sub_political(_match, p1) { let x = p1 | 0 let n = political_cards[x].title return `<span class="card_tip" onmouseenter="on_focus_political_tip(${x})" onmouseleave="on_blur_political_tip(${x})">${n}</span>` } -function sub_piece(match, p1) { +function sub_piece(_match, p1) { let x = p1 | 0 let n = piece_log_name[x] let p = power_class[piece_power[x]] return `<span class="piece_tip ${p}" onclick="on_click_piece_tip(${x})" onmouseenter="on_focus_piece_tip(${x})" onmouseleave="on_blur_piece_tip(${x})">${n}</span>` } -function sub_space(match, p1) { +function sub_space(_match, p1) { let x = p1 | 0 if (x === ELIMINATED) return "eliminated" @@ -1899,18 +1896,18 @@ function propose_deal() { form.a_power.value = view.power switch (view.power) { - case P_FRANCE: - form.b_power.value = P_PRUSSIA - break - case P_PRUSSIA: - form.b_power.value = P_FRANCE - break - case P_PRAGMATIC: - form.b_power.value = P_AUSTRIA - break - case P_AUSTRIA: - form.b_power.value = P_PRAGMATIC - break + case P_FRANCE: + form.b_power.value = P_PRUSSIA + break + case P_PRUSSIA: + form.b_power.value = P_FRANCE + break + case P_PRAGMATIC: + form.b_power.value = P_AUSTRIA + break + case P_AUSTRIA: + form.b_power.value = P_PRAGMATIC + break } form.a_turn.value = view.turn form.b_turn.value = view.turn |