From 092a76abde95a2f947698afb581f2e6f443747c3 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 21 Jul 2023 17:14:42 +0200 Subject: Offset quaestor markers when coexisting with breakaway markers. --- play.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index de6dfb6..06fb3e8 100644 --- a/play.js +++ b/play.js @@ -854,17 +854,6 @@ function on_init() { for (let i = 0; i < LEGION_COUNT; ++i) ui.legions[i] = create_piece(i, "legion", "legion", "legion_" + i) - for (let p = 0; p < 4; ++p) { - for (let i = 0; i < 12; ++i) { - ui.seat_of_power[p * 12 + i] = create_thing({ className: PLAYER_CLASS[p] + " seat_of_power hide" }) - ui.seat_of_power[p * 12 + i].style.left = (LAYOUT_QUAESTOR[i][0] + 16) + "px" - ui.seat_of_power[p * 12 + i].style.top = (LAYOUT_QUAESTOR[i][1]) + "px" - ui.breakaway[p * 12 + i] = create_thing({ className: PLAYER_CLASS[p] + " breakaway hide" }) - ui.breakaway[p * 12 + i].style.left = (LAYOUT_QUAESTOR[i][0] + 16) + "px" - ui.breakaway[p * 12 + i].style.top = (LAYOUT_QUAESTOR[i][1]) + "px" - } - } - ui.rival_emperors[0] = create_piece(0, "rival_emperor", "rival_emperor postumus", "postumus") ui.rival_emperors[1] = create_piece(1, "rival_emperor", "rival_emperor priest_king", "priest_king") ui.rival_emperors[2] = create_piece(2, "rival_emperor", "rival_emperor zenobia", "zenobia") @@ -917,6 +906,17 @@ function on_init() { for (let region = 12; region < 21; ++region) { register_action(ui.regions[region], "region", region) } + + for (let p = 0; p < 4; ++p) { + for (let i = 0; i < 12; ++i) { + ui.seat_of_power[p * 12 + i] = create_thing({ className: PLAYER_CLASS[p] + " seat_of_power hide" }) + ui.seat_of_power[p * 12 + i].style.left = (LAYOUT_QUAESTOR[i][0] + 16) + "px" + ui.seat_of_power[p * 12 + i].style.top = (LAYOUT_QUAESTOR[i][1]) + "px" + ui.breakaway[p * 12 + i] = create_thing({ className: PLAYER_CLASS[p] + " breakaway hide" }) + ui.breakaway[p * 12 + i].style.left = (LAYOUT_QUAESTOR[i][0] + 16) + "px" + ui.breakaway[p * 12 + i].style.top = (LAYOUT_QUAESTOR[i][1]) + "px" + } + } } let stack_count = new Array(21).fill(0) @@ -1164,10 +1164,14 @@ function on_update() { } } - if (has_quaestor(region)) + if (has_quaestor(region)) { show(ui.quaestor[region]) - else + if (is_seat_of_power(region) || is_breakaway(region)) + ui.quaestor[region].classList.add("pretender") + } else { hide(ui.quaestor[region]) + ui.quaestor[region].classList.remove("pretender") + } if (has_amphitheater(region)) show(ui.amphitheater[region]) -- cgit v1.2.3