summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-01-12 15:43:07 +0100
committerTor Andersson <tor@ccxvii.net>2022-11-16 19:19:39 +0100
commit4861c41e8c8cfad2779f8773947856b58fe0c876 (patch)
treee677ca84e1f10a933b7bed1bafa883a53827b7d8
parent51cfcf6adeb73b08d6e3ce518c37deffb5e729cd (diff)
downloadcrusader-rex-4861c41e8c8cfad2779f8773947856b58fe0c876.tar.gz
Only reveal all blocks in replay.
-rw-r--r--play.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/play.js b/play.js
index 75f5554..35b015a 100644
--- a/play.js
+++ b/play.js
@@ -469,14 +469,15 @@ function hide_block(element) {
ui.offmap_element.appendChild(element);
}
-function is_known_block(info, who) {
- if (view.game_over)
+function is_known_block(info, who, town) {
+ if (view.game_over && player === 'Observer')
return true;
- if (info.owner === player || info.owner === ASSASSINS || who === view.assassinate)
- return true;
- let town = view.location[who];
if (town === DEAD)
return true;
+ if ((town === S_POOL || town === F_POOL) && who !== view.who)
+ return false;
+ if (info.owner === player || info.owner === ASSASSINS || who === view.assassinate)
+ return true;
return false;
}
@@ -507,12 +508,10 @@ function update_map() {
let moved = view.moved[b] ? " moved" : "";
if (town === DEAD)
moved = " moved";
- if (is_known_block(info, b)) {
+ if (is_known_block(info, b, town)) {
let image = " block_" + info.image;
let steps = " r" + (info.steps - view.steps[b]);
let known = " known";
- if ((town === S_POOL || town === F_POOL) && b !== view.who && !view.game_over)
- known = "";
element.classList = info.owner + known + " block" + image + steps + moved;
} else {
let besieging = "";