summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2022-03-08 18:56:06 +0100
committerTor Andersson <tor@ccxvii.net>2022-03-08 18:56:22 +0100
commitfac8af2866827e2b2b27d8efbab8e24b06739e56 (patch)
treef0c687532c79e8479c74e7adc08ce3e534d25e12 /public
parentbd74b662fbac99a0b3987e454fdc129784820992 (diff)
downloadserver-fac8af2866827e2b2b27d8efbab8e24b06739e56.tar.gz
Allow "query" calls as Observer and during replays.
Diffstat (limited to 'public')
-rw-r--r--public/common/play.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/public/common/play.js b/public/common/play.js
index 0fa432a..1ebc9dd 100644
--- a/public/common/play.js
+++ b/public/common/play.js
@@ -553,11 +553,19 @@ function send_action(verb, noun) {
return false;
}
+let replay_query = null;
+
function send_query(q, param) {
if (param !== undefined)
- send_message("query", [q, param]);
+ if (replay_query)
+ replay_query(q, param);
+ else
+ send_message("query", [q, param]);
else
- send_message("query", q);
+ if (replay_query)
+ replay_query(q, undefined);
+ else
+ send_message("query", q);
}
function confirm_resign() {
@@ -649,6 +657,11 @@ async function init_replay() {
}
}
+ replay_query = function (query, params) {
+ let reply = rules.query(s, player, query, params);
+ on_reply(query, reply);
+ }
+
let ss;
for (p = 0; p < replay.length; ++p) {
replay[p].arguments = JSON.parse(replay[p].arguments);