diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-07-02 21:04:13 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:19:39 +0100 |
commit | 350570d87d9b322ba1f265bc08defa162f8ebed5 (patch) | |
tree | 578a8f5fd0814e2effd635ec320b1f04ddcf8ff6 /ui.js | |
parent | 88eabb2b84ff90377630a722a0f593189c6704ad (diff) | |
download | crusader-rex-350570d87d9b322ba1f265bc08defa162f8ebed5.tar.gz |
crusader: Show both pools on map.
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -375,6 +375,8 @@ function build_map() { for (let name in TOWNS) { let town = TOWNS[name]; + if (name == F_POOL || name == S_POOL || name == DEAD) + continue; if (name == "Sea") { element = document.getElementById("svgmap").getElementById("sea"); element.town = "Sea"; @@ -383,7 +385,11 @@ function build_map() { element.addEventListener("click", on_click_town); ui.towns[name] = element; } else { - ui.towns[name] = build_town(name, town); + element = ui.towns[name] = build_town(name, town); + let xo = Math.round(element.offsetWidth/2); + let yo = Math.round(element.offsetHeight/2); + element.style.left = (town.x - xo) + "px"; + element.style.top = (town.y - yo) + "px"; } } @@ -392,8 +398,6 @@ function build_map() { ui.blocks[b] = build_map_block(b, block); build_battle_block(b, block); } - - update_map_layout(); } function update_steps(b, steps, element) { @@ -595,15 +599,6 @@ function update_map() { let element = ui.blocks[b]; let town = game.location[b]; - if ((town == F_POOL && player != FRANKS) || (town == S_POOL && player != SARACENS)) { - hide_block(element); - continue; - } - if (town == DEAD && player != info.owner) { - hide_block(element) - continue; - } - if (town in TOWNS) { let moved = game.moved[b] ? " moved" : ""; if (town == DEAD) @@ -628,7 +623,11 @@ function update_map() { jihad = " jihad"; element.classList = info.owner + " block" + moved + besieging + jihad; } - if (info.owner == FRANKS) + if (town == F_POOL || town == S_POOL) + layout[F_POOL].north.push(element); + else if (town == DEAD) + layout[DEAD].north.push(element); + else if (info.owner == FRANKS) layout[town].north.push(element); else layout[town].south.push(element); |