summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-11-19 21:38:35 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-18 13:02:37 +0100
commit3a83d94096a32e838f3331932644f4495593e6e8 (patch)
treef10f854b347e9b3f76760c8cb830de285186ddd3 /play.js
parentd9fad71090880cda0825ea10b82388cacc4e0122 (diff)
downloadnevsky-3a83d94096a32e838f3331932644f4495593e6e8.tar.gz
Show mustered vassals.
Diffstat (limited to 'play.js')
-rw-r--r--play.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/play.js b/play.js
index 1b94404..0493bb2 100644
--- a/play.js
+++ b/play.js
@@ -274,6 +274,8 @@ const ui = {
forces: [],
routed: [],
assets: [],
+ ready_vassals: [],
+ mustered_vassals: [],
lord_capabilities: [],
arts_of_war: [],
boxes: {},
@@ -538,14 +540,15 @@ function update_assets(parent, assets) {
}
}
-function update_vassals(parent, lord_ix) {
+function update_vassals(ready_parent, mustered_parent, lord_ix) {
for (let v of data.lords[lord_ix].vassals) {
let e = ui.vassal_service[v]
if (view.vassals[v] === 0) {
e.classList.remove("hide")
- parent.appendChild(e)
+ ready_parent.appendChild(e)
} else {
- e.classList.add("hide")
+ e.classList.remove("hide")
+ mustered_parent.appendChild(e)
}
e.classList.toggle("action", is_vassal_action(v))
}
@@ -553,7 +556,7 @@ function update_vassals(parent, lord_ix) {
function update_lord_mat(ix) {
update_assets(ui.assets[ix], view.lords.assets[ix])
- update_vassals(ui.assets[ix], ix)
+ update_vassals(ui.ready_vassals[ix], ui.mustered_vassals[ix], ix)
update_forces(ui.forces[ix], view.lords.forces[ix])
update_forces(ui.routed[ix], view.lords.routed_forces[ix])
}
@@ -861,9 +864,11 @@ function build_lord_mat(lord, ix, side, name) {
let parent = document.getElementById(side === 'teutonic' ? "p1_court" : "p2_court")
let mat = build_div(parent, `mat ${side} ${name} hide`)
let bg = build_div(mat, "background")
- ui.forces[ix] = build_div(bg, "forces", ix)
- ui.routed[ix] = build_div(bg, "routed", ix)
- ui.assets[ix] = build_div(bg, "assets", ix)
+ ui.forces[ix] = build_div(bg, "forces")
+ ui.routed[ix] = build_div(bg, "routed")
+ ui.assets[ix] = build_div(bg, "assets")
+ ui.ready_vassals[ix] = build_div(bg, "ready_vassals")
+ ui.mustered_vassals[ix] = build_div(bg, "mustered_vassals")
ui.lord_capabilities[ix] = build_div(mat, "capabilities")
ui.lord_mat[ix] = mat
}