summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-05 01:48:32 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-06 01:50:27 +0100
commit45d9112c08af8540cf80c19467b52684eea41f40 (patch)
tree794c86962bf3211aa9b4826d94910922b21fde0e /play.js
parentf70e6b96fd41958e1e90eec77273667e908234fc (diff)
downloadmaria-45d9112c08af8540cf80c19467b52684eea41f40.tar.gz
WIP subsidy list
This reverts commit e33e549f80cbf6b208300a8e41cbdfb7bba6e05a.
Diffstat (limited to 'play.js')
-rw-r--r--play.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/play.js b/play.js
index f92ac77..15dad7b 100644
--- a/play.js
+++ b/play.js
@@ -1539,6 +1539,7 @@ function on_update() {
"propose_deal",
])
+ update_subsidy_list(view.contracts, window.subsidy_list, "Active Subsidies")
update_deal_list(view.deals, window.active_deal_list, "Active Deals")
if (view.proposed_deal) {
update_deal_list([ view.proposed_deal ], window.proposed_deal_list, "Proposed Deal")
@@ -1714,6 +1715,25 @@ function html_escape(str) {
return str.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")
}
+function update_subsidy_list(subs, elt, title) {
+ let show = false
+ let str = "<table><tr><th colspan=3>" + title
+ for (let from of all_major_powers) {
+ map_for_each(subs[from], (to, n) => {
+ show = true
+ str += "<tr><td width=24>" + power_image[from]
+ str += "<td width=24>" + power_image[to]
+ str += "<td>" + n + " TC"
+ })
+ }
+ if (show) {
+ elt.innerHTML = str
+ elt.style.display = "block"
+ } else {
+ elt.style.display = "none"
+ }
+}
+
function update_deal_item(deal) {
let [ turn, a_power, b_power, a_promise, b_promise ] = deal
let str = "<tr>"