From a0ee653860e471bba2fb1cd8d7611fd633af9878 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 16 Sep 2022 00:00:25 +0200 Subject: Show perma-dead blocks in pools as well. Adjust pool positions to allow for more blocks. --- play.js | 71 ++++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 29 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 216bbb3..a6b18f6 100644 --- a/play.js +++ b/play.js @@ -504,38 +504,39 @@ function update_map() { let info = BLOCKS[b]; let element = ui.blocks[b]; let town = view.location[b]; - if (town in TOWNS) { - let moved = view.moved[b] ? " moved" : ""; - if (town === DEAD) - moved = " moved"; - if (is_known_block(info, b, town)) { - let image = " block_" + info.image; - let steps = " r" + (info.steps - view.steps[b]); - let known = " known"; - element.classList = info.owner + known + " block" + image + steps + moved; - } else { - let besieging = ""; - if (view.sieges[town] === info.owner) { - if (view.winter_campaign === town) - besieging = " winter_campaign"; - else - besieging = " besieging"; - } - let jihad = ""; - if (view.jihad === town && info.owner === view.p1) - jihad = " jihad"; - element.classList = info.owner + " block" + moved + besieging + jihad; - } - if (town !== DEAD) { - if (info.owner === FRANKS) - layout[town].north.push(element); + let moved = view.moved[b] ? " moved" : ""; + if (town === DEAD) { + moved = " moved"; + } + if (town === null) { + town = DEAD; + moved = " removed"; + } + if (is_known_block(info, b, town)) { + let image = " block_" + info.image; + let steps = " r" + (info.steps - view.steps[b]); + let known = " known"; + element.classList = info.owner + known + " block" + image + steps + moved; + } else { + let besieging = ""; + if (view.sieges[town] === info.owner) { + if (view.winter_campaign === town) + besieging = " winter_campaign"; else - layout[town].south.push(element); + besieging = " besieging"; } - show_block(element); - } else { - hide_block(element); + let jihad = ""; + if (view.jihad === town && info.owner === view.p1) + jihad = " jihad"; + element.classList = info.owner + " block" + moved + besieging + jihad; + } + if (town !== DEAD) { + if (info.owner === FRANKS) + layout[town].north.push(element); + else + layout[town].south.push(element); } + show_block(element); } for (let b in view.location) { @@ -550,6 +551,18 @@ function update_map() { } } + for (let b in view.location) { + let info = BLOCKS[b]; + let element = ui.blocks[b]; + let town = view.location[b]; + if (town === null) { + if (info.owner === FRANKS) + layout[F_POOL].north.unshift(element); + else + layout[S_POOL].south.unshift(element); + } + } + for (let town in TOWNS) layout_blocks(town, layout[town].north, layout[town].south); -- cgit v1.2.3