summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-24 12:24:54 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-24 12:24:54 +0200
commit04c68c2668de902246630b658c799c406f4187fa (patch)
tree9da5363684800b86b449e84485ff28b2f77950ef
parent45a517567b44ed1a0a01bee24a181889566480e0 (diff)
downloadmaria-04c68c2668de902246630b658c799c406f4187fa.tar.gz
Show active subsidies in power panels.
-rw-r--r--play.css16
-rw-r--r--play.js22
-rw-r--r--rules.js3
3 files changed, 30 insertions, 11 deletions
diff --git a/play.css b/play.css
index d288ba3..792b1a4 100644
--- a/play.css
+++ b/play.css
@@ -363,6 +363,22 @@ span.suit.reserve { color: var(--color-reserve); font-weight: bold; font-family:
/* MARKERS */
+span.subsidy {
+ display: inline-block;
+ font-weight: bold;
+ line-height: 1;
+ margin: 0 2px;
+ padding: 0 2px;
+ border: 1px solid black;
+}
+
+span.subsidy.france { color: gold; background-color: #f21c26 }
+span.subsidy.prussia { color: gold; background-color: #005988 }
+span.subsidy.pragmatic { color: gainsboro; background-color: #7d7a7a }
+span.subsidy.austria { color: #444; background-color: white }
+span.subsidy.bavaria { color: brown; background-color: #fca808 }
+span.subsidy.saxony { color: gold; background-color: #147d36 }
+
#combat {
position: absolute;
width: 36px;
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 += `<span class="subsidy ${power_class[other]}">S</span>`
+ })
}
- 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])
+}
diff --git a/rules.js b/rules.js
index 15da8c1..94db101 100644
--- a/rules.js
+++ b/rules.js
@@ -5283,9 +5283,10 @@ exports.view = function (state, player) {
troops: mask_troops(player),
hand1: mask_hand1(player),
hand2: mask_hand2(player),
- pt: total_troops_list(),
+ // pt: total_troops_list(),
discard: total_discard_list(),
+ contracts: game.contracts,
pol_deck: mask_pol_deck(),
face_up: game.face_up,
face_down: mask_face_down(),