From c42d4827f09e78ada7cc0954b22f12092f910da7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 1 Dec 2024 16:27:56 +0100 Subject: Misc cleanups. --- info/readme.html | 2 +- play.js | 55 ++++++++++++++++++++++++++----------------------------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/info/readme.html b/info/readme.html index 1745a0e..903beb0 100644 --- a/info/readme.html +++ b/info/readme.html @@ -48,7 +48,7 @@ on the political display.

If you check the Politics/Movement/Retreat/Hussars checkboxes when creating a deal, -the counterparty will be able to validate your actions so that you abide by your promise. +the counterparty will be able to validate your actions so that you keep your promise. If they deem that you have broken your promise, your moves will be undone and you have to start over. This can be a helpful feature so you don't break your promises accidentally. diff --git a/play.js b/play.js index c02620e..c14d442 100644 --- a/play.js +++ b/play.js @@ -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 `${n}` } -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 `${n}` } -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 -- cgit v1.2.3