summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-17 00:40:07 +0200
committerTor Andersson <tor@ccxvii.net>2024-08-21 00:28:20 +0200
commit5424a2756d266a983ded718c4f36412cbbfac07a (patch)
tree7aa651c5cb2344406a51543efff3abb013a97795 /play.js
parent842b8915070cdb982a212a1be2a9805e095bf571 (diff)
downloadwashingtons-war-5424a2756d266a983ded718c4f36412cbbfac07a.tar.gz
WIP cu
Diffstat (limited to 'play.js')
-rw-r--r--play.js10
1 files changed, 7 insertions, 3 deletions
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)