From 5424a2756d266a983ded718c4f36412cbbfac07a Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 17 May 2024 00:40:07 +0200 Subject: WIP cu --- play.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 98646cb..dc5863e 100644 --- a/play.js +++ b/play.js @@ -234,6 +234,10 @@ function build_map() { } } +function get_space_pc(space) { + return view.pc[space] & 3 +} + function update_units() { const unitW = 130 / 2 const unitH = 263 / 2 @@ -273,7 +277,7 @@ function update_units() { } for (let space = 0; space < space_count; ++space) { - let space_pc = view.pc[space] + let space_pc = get_space_pc(space) let e = ui.pc[space] if (space_pc === PC_BRITISH) { e.classList.remove("american") @@ -290,9 +294,9 @@ function update_units() { for (let c = 0; c <= 13; ++c) { let control = 0 for (let space of COLONIES[c]) { - if (view.pc[space] == PC_BRITISH) + if (get_space_pc(space) == PC_BRITISH) --control - else if (view.pc[space] == PC_AMERICAN) + else if (get_space_pc(space) == PC_AMERICAN) ++control } if (control < 0) -- cgit v1.2.3