diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 71 |
1 files changed, 42 insertions, 29 deletions
@@ -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); |