summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-09-22 15:26:27 +0200
committerTor Andersson <tor@ccxvii.net>2022-10-05 17:36:50 +0200
commitc9219303197ad242a97b7851ace5503cb6e23f25 (patch)
treede7fe8d58d04f73b581b8407cb9d50bd2a6d2b54
parent8dfef7634ee84eb731461058bb1785f8cf472564 (diff)
downloadserver-c9219303197ad242a97b7851ace5503cb6e23f25.tar.gz
Simplify replay callbacks (don't need to handle blank start state).
-rw-r--r--public/common/play.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/public/common/play.js b/public/common/play.js
index e80dc08..613d3a3 100644
--- a/public/common/play.js
+++ b/public/common/play.js
@@ -620,14 +620,14 @@ function send_restart(scenario) {
/* REPLAY */
-function deep_copy(original) {
+function object_copy(original) {
if (Array.isArray(original)) {
let n = original.length
let copy = new Array(n)
for (let i = 0; i < n; ++i) {
let v = original[i]
if (typeof v === "object" && v !== null)
- copy[i] = deep_copy(v)
+ copy[i] = object_copy(v)
else
copy[i] = v
}
@@ -637,7 +637,7 @@ function deep_copy(original) {
for (let i in original) {
let v = original[i]
if (typeof v === "object" && v !== null)
- copy[i] = deep_copy(v)
+ copy[i] = object_copy(v)
else
copy[i] = v
}
@@ -722,8 +722,8 @@ async function init_replay(debug) {
replay[p].arguments = JSON.parse(replay[p].arguments)
if (rules.is_checkpoint) {
- replay[p].is_checkpoint = (p > 0 && rules.is_checkpoint(ss, s))
- ss = deep_copy(s)
+ replay[p].is_checkpoint = p > 1 && rules.is_checkpoint(ss, s)
+ ss = object_copy(s)
}
try {