From 04c68c2668de902246630b658c799c406f4187fa Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 24 Oct 2024 12:24:54 +0200 Subject: Show active subsidies in power panels. --- play.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index b514a2a..5e8357f 100644 --- a/play.js +++ b/play.js @@ -1142,17 +1142,15 @@ function on_update() { layout_hussar(p, view.pos[p]) for (let pow of all_powers) { - /* - let banner = `${power_name[pow]} \u2014 ${view.pt[pow]} troops` - let m_obj = count_total_objectives(pow) - if (m_obj > 0) { - let n_obj = count_captured_objectives(pow) - if (pow === P_AUSTRIA && view.oo) - m_obj += "*" - banner += ` \u2014 ${n_obj} of ${m_obj} objectives` + let banner = power_name[pow] + if (view.contracts[pow] && view.contracts[pow].length > 0) { + map_for_each(view.contracts[pow], (other, n) => { + banner += " \u2014 " + for (let i = 0; i < n; ++i) + banner += `S` + }) } - ui.power_header[pow].textContent = banner - */ + ui.power_header[pow].innerHTML = banner ui.hand[pow].replaceChildren() for (let c of view.hand1[pow].slice().sort(cmp_tc)) @@ -1479,3 +1477,7 @@ function map_get(map, key, missing) { return missing } +function map_for_each(map, f) { + for (let i = 0; i < map.length; i += 2) + f(map[i], map[i+1]) +} -- cgit v1.2.3