From e94ef87d23f1ea8ffe74390e95f6dedad1fc515d Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 15 Sep 2023 18:17:19 +0200 Subject: Improve sync error handling. 1) Show warning during one second then resume game. 2) Don't update cookie during simultaneous turns. When playing SoT live, discarding cards at the same time leads to many harmless in-flight action collision errors, which don't really matter. If we stop updating the cookie during simultaneous turns, we can avoid this. --- public/common/play.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'public') diff --git a/public/common/play.js b/public/common/play.js index cf4bcad..e34f42c 100644 --- a/public/common/play.js +++ b/public/common/play.js @@ -442,6 +442,15 @@ function connect_play() { let arg = msg_data[1] console.log("MESSAGE", cmd) switch (cmd) { + case "warning": + document.getElementById("prompt").textContent = arg + document.querySelector("header").classList.add("disconnected") + setTimeout(() => { + document.querySelector("header").classList.remove("disconnected") + on_update_header() + }, 1000) + break + case "error": document.getElementById("prompt").textContent = arg if (view) { -- cgit v1.2.3