diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-06-23 19:50:21 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-11-16 19:12:55 +0100 |
commit | 49edc29cda6d4da620fc4809f036a610b8b27f42 (patch) | |
tree | 7f117cfd1ccf4da51a1216f11bf9a06c69a175ff | |
parent | 89ac1f61defbf542b97d16fd1eb3232392e3b505 (diff) | |
download | richard-iii-49edc29cda6d4da620fc4809f036a610b8b27f42.tar.gz |
richard: Layout blocks based on ownership.
-rw-r--r-- | play.html | 2 | ||||
-rw-r--r-- | ui.js | 14 |
2 files changed, 11 insertions, 5 deletions
@@ -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; } @@ -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]) { |