From c5e5a7c958eb3a9be74db5864e8f2806f93af277 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Tue, 28 Jan 2020 18:24:34 +0100 Subject: [PATCH] Now that we can receive game messages from several games at once, make sure the Game module only handles the ones for the current game --- js/GUI/Screen/Game.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/GUI/Screen/Game.js b/js/GUI/Screen/Game.js index 642b185..c4c5adb 100644 --- a/js/GUI/Screen/Game.js +++ b/js/GUI/Screen/Game.js @@ -80,11 +80,13 @@ function previously(states) { function initMessageHandlers() { window.addEventListener('focus', catchUp); Messaging.addEventListener(["Game"], function(o) { - delay(handleGameMessage(o.state)); - if(document.hasFocus() && getQueue().length == 1) { - catchUp(); - } else { - StatusHandler.set("♪"); + if(o.state.public.coordinates.gameID == globalState.game.public.coordinates.gameID) { + delay(handleGameMessage(o.state)); + if(document.hasFocus() && getQueue().length == 1) { + catchUp(); + } else { + StatusHandler.set("♪"); + } } }); }