summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-16 00:13:20 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-17 12:53:18 +0100
commit02591e34c384be9e0785eb5f1d1482ac8310b66a (patch)
treef382e5d8f86c54b53336187b3b82473740e54835
parent3e258bd20fe6d369c3b4d235da6338275b3b46cb (diff)
downloadhammer-of-the-scots-02591e34c384be9e0785eb5f1d1482ac8310b66a.tar.gz
Show eliminated/out-of-game blocks in separate row.
-rw-r--r--play.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/play.js b/play.js
index fbc462b..f5483a6 100644
--- a/play.js
+++ b/play.js
@@ -449,23 +449,39 @@ function update_map() {
layout[area] = { north: [], south: [] }
for (let b in view.location) {
+ if (view.location[b] === null && BLOCKS[b].mortal) {
+ let element = ui.blocks[b]
+ if (BLOCKS[b].owner === SCOTLAND)
+ layout[SCOTLAND_BAG].north.push(element)
+ else
+ layout[ENGLAND_BAG].south.push(element)
+ }
+ }
+
+ for (let b in view.location) {
let info = BLOCKS[b]
let element = ui.blocks[b]
let area = view.location[b]
- if (area in AREAS) {
+ if (area in AREAS || BLOCKS[b].mortal) {
let moved = view.moved[b] ? " moved" : ""
- if (is_known_block(b)) {
+ if (is_known_block(b) || area === null) {
let image = " block_" + info.image
let steps = " r" + (info.steps - view.steps[b])
let known = " known"
+ if (area === null) {
+ moved = " moved"
+ steps = " r0"
+ }
element.classList = info.owner + known + " block" + image + steps + moved
} else {
element.classList = info.owner + " block" + moved
}
- if (info.owner === SCOTLAND)
- layout[area].north.push(element)
- else
- layout[area].south.push(element)
+ if (area !== null) {
+ if (info.owner === SCOTLAND)
+ layout[area].north.push(element)
+ else
+ layout[area].south.push(element)
+ }
show_block(element)
} else {
hide_block(element)