diff options
author | Tor Andersson <tor@ccxvii.net> | 2024-10-16 19:04:06 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-10-16 19:04:06 +0200 |
commit | 4beb78140f7d71ca546c30bada088390b1cecb26 (patch) | |
tree | f694357523df19099976d6ce9ddcd261af6971ff /play.js | |
parent | ad4b6f83404500b4361e83497751ac65160c9574 (diff) | |
download | maria-4beb78140f7d71ca546c30bada088390b1cecb26.tar.gz |
layout eliminated pieces in the north sea
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 61 |
1 files changed, 31 insertions, 30 deletions
@@ -35,13 +35,14 @@ const last_city = data.cities.name.length - 1 const ELIMINATED = data.cities.name.length const REMOVED = ELIMINATED + 1 -const ELIMINATED_TRAIN_X = 1065 -const ELIMINATED_TRAIN_Y = 210 -const ELIMINATED_DISC_X = 1365 -const ELIMINATED_DISC_Y = 210 -const ELIMINATED_GENERAL_X = 1040 -const ELIMINATED_GENERAL_Y = 160 +const ELIMINATED_TRAIN_X = 340 +const ELIMINATED_TRAIN_Y = 160 +const ELIMINATED_TRAIN_DX = 33 +const ELIMINATED_GENERAL_X = 340 +const ELIMINATED_GENERAL_Y = 110 const ELIMINATED_GENERAL_DX = 50 +const ELIMINATED_DISC_X = 340 + 75 +const ELIMINATED_DISC_Y = 240 const power_class = [ "france", "bavaria", "prussia", "saxony", "pragmatic", "austria" ] const power_name = [ "France", "Bavaria", "Prussia", "Saxony", "Pragmatic", "Austria" ] @@ -703,7 +704,7 @@ function layout_general_offset_elim(g) { function layout_train_offset(g, s) { let n = 0 - for (let i = g+1; i < 35; ++i) + for (let i = 20; i < g; ++i) if (view.pos[i] === s) ++n return n @@ -716,6 +717,28 @@ function get_cylinder_power(id) { return -1 } +function layout_hussar(id, s) { + let e = ui.pieces[id] + let n = 0 + let x, y + + if (e.parentElement !== ui.pieces_element) + ui.pieces_element.appendChild(e) + + if (s === ELIMINATED) { + x = ELIMINATED_DISC_X + y = ELIMINATED_DISC_Y + n = id - 30 + } else { + x = data.cities.x[s] + y = data.cities.y[s] + } + + e.style.left = (x - 21) + "px" + e.style.top = (y - 29 + 7 - n * 8) + "px" + e.classList.toggle("selected", set_has(view.selected, id)) +} + function layout_general(id, s) { let x, y, n @@ -778,33 +801,11 @@ function layout_train(id, s) { y = data.cities.y[s] } - e.style.left = (x - 14 + n * 33) + "px" + e.style.left = (x - 14 + n * ELIMINATED_TRAIN_DX) + "px" e.style.top = (y - 21 - n * 0) + "px" e.classList.toggle("selected", set_has(view.selected, id)) } -function layout_hussar(id, s) { - let e = ui.pieces[id] - let n = 0 - let x, y - - if (e.parentElement !== ui.pieces_element) - ui.pieces_element.appendChild(e) - - if (s === ELIMINATED) { - x = ELIMINATED_DISC_X - y = ELIMINATED_DISC_Y - n = id - 30 - } else { - x = data.cities.x[s] - y = data.cities.y[s] - } - - e.style.left = (x - 14) + "px" - e.style.top = (y - 16 - n * 12) + "px" - e.classList.toggle("selected", set_has(view.selected, id)) -} - function layout_combat_marker() { let x = (data.cities.x[view.attacker] + data.cities.x[view.defender]) >> 1 let y = (data.cities.y[view.attacker] + data.cities.y[view.defender]) >> 1 |