From 49edc29cda6d4da620fc4809f036a610b8b27f42 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 23 Jun 2021 19:50:21 +0200 Subject: richard: Layout blocks based on ownership. --- play.html | 2 +- ui.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/play.html b/play.html index 471ece0..12f5ef5 100644 --- a/play.html +++ b/play.html @@ -146,7 +146,7 @@ div.block.Lancaster { border: 3px solid brown; background-color: brown; } div.block.York { border: 3px solid gainsboro; background-color: gainsboro; } div.block.Rebel { border: 3px solid dimgray; background-color: dimgray; } -div.block.Lancaster.highlight { border-color: white; } +div.block.Lancaster.highlight { border-color: red; } div.block.York.highlight { border-color: white; } div.block.Rebel.highlight { border-color: white; } diff --git a/ui.js b/ui.js index 779cbf0..7b2c336 100644 --- a/ui.js +++ b/ui.js @@ -489,7 +489,7 @@ function update_map() { "\nPretender: " + block_name(game.pretender); for (let area in AREAS) - layout[area] = { secret: [], known: [] }; + layout[area] = { Lancaster: [], York: [] }; // Move secret blocks to overflow queue if there are too many in a area for (let area in AREAS) { @@ -550,7 +550,10 @@ function update_map() { element.classList.remove("moved"); else element.classList.add("moved"); - layout[area].secret.push(element); + if (color == REBEL) + layout[area][game.pretender].push(element); + else + layout[area][color].push(element); } } } @@ -562,9 +565,12 @@ function update_map() { let steps = game.known[b][1]; let moved = game.known[b][2]; let element = ui.known[b]; + let color = BLOCKS[b].owner; + if (color == REBEL) + color = game.pretender; show_block(element); - layout[area].known.push(element); + layout[area][color].push(element); update_steps(b, steps, element); if (moved) @@ -576,7 +582,7 @@ function update_map() { // Layout blocks on map for (let area in AREAS) - layout_blocks(area, layout[area].secret, layout[area].known); + layout_blocks(area, layout[area].Lancaster, layout[area].York); for (let where in AREAS) { if (ui.areas[where]) { -- cgit v1.2.3