summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-16 00:00:25 +0200
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commita0ee653860e471bba2fb1cd8d7611fd633af9878 (patch)
tree81a5be124e90b3926f4ac0ab526f29106b4c9825 /play.js
parent95f92ad9f434dd54de00fc70269971e96bedf3a9 (diff)
downloadcrusader-rex-a0ee653860e471bba2fb1cd8d7611fd633af9878.tar.gz
Show perma-dead blocks in pools as well.
Adjust pool positions to allow for more blocks.
Diffstat (limited to 'play.js')
-rw-r--r--play.js71
1 files changed, 42 insertions, 29 deletions
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);