diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-08-12 10:00:15 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-10-01 16:11:21 +0200 |
commit | 644d5b7e72e7ac00b5a95951b5430b519e93f146 (patch) | |
tree | d6461e70cc21faf614a5ba5cd027ff7e46881642 /play.js | |
parent | 22be520ec9a59b5ea5f7b9bd2c82181bdc0d7e3d (diff) | |
download | waterloo-campaign-1815-644d5b7e72e7ac00b5a95951b5430b519e93f146.tar.gz |
Stuff.
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -27,6 +27,10 @@ function set_has(set, item) { const FRENCH = "French" const COALITION = "Coalition" +const TURN_X = 20 - 70 + 35 + 8 +const TURN_Y = 1745 +const TURN_DX = 70 + let ui = { hexes: new Array(last_hex+1).fill(null), sides: new Array((last_hex+1)*3).fill(null), @@ -176,10 +180,10 @@ function on_update() { } for (let id = 0; id < piece_count; ++id) { - let hex = view.pieces[id] + let hex = view.pieces[id] >> 1 if (hex >= first_hex) { ui.pieces[id].classList.remove("hide") - ui.pieces[id].classList.toggle("flip", !!view.mode[id]) + ui.pieces[id].classList.toggle("flip", (view.pieces[id] & 1) === 1) let x = ui.hex_x[hex] - ui.stack[hex] * 18 let y = ui.hex_y[hex] + ui.stack[hex] * 12 ui.stack[hex] += 1 @@ -192,6 +196,21 @@ function on_update() { } ui.pieces[id].style.top = y + "px" ui.pieces[id].style.left = x + "px" + } else if (hex >= 1) { + ui.pieces[id].classList.remove("hide") + ui.pieces[id].classList.remove("flip") + let x = TURN_X + hex * TURN_DX - ui.stack[hex] * 18 + let y = TURN_Y + ui.stack[hex] * 12 + ui.stack[hex] += 1 + if (id <= last_corps) { + x -= (46>>1) + y -= (46>>1) + } else { + x -= (38>>1) + y -= (38>>1) + } + ui.pieces[id].style.top = y + "px" + ui.pieces[id].style.left = x + "px" } else { ui.pieces[id].classList.add("hide") } @@ -212,6 +231,7 @@ function on_update() { action_button("edit_stream", "Stream") action_button("edit_road", "Road") + action_button("next", "Next") action_button("pass", "Pass") action_button("undo", "Undo") } |