Bugfix : code wasn't comparing the game coordinates

This commit is contained in:
Tissevert 2020-01-30 15:05:12 +01:00
parent c5e5a7c958
commit fb3bb64ff6
1 changed files with 6 additions and 4 deletions

View File

@ -40,10 +40,12 @@ function initMessageHandlers() {
Messaging.addEventListener(["Relay", "Sync"], function(o) {
var gameID = o.message.latestKnown.gameID;
var state = states.get(gameID);
switch(state != undefined && compare(state.latest, o.message.latestKnown)) {
case -1: Messaging.send({tag: "Yield", onGameID: gameID});
case 1: Messaging.send({tag: "Share", gameSave: state.latest});
}
if(state != undefined) {
switch(compare(state.latest.public.coordinates, o.message.latestKnown)) {
case -1: Messaging.send({tag: "Yield", onGameID: gameID});
case 1: Messaging.send({tag: "Share", gameSave: state.latest});
}
}
});
Messaging.addEventListener(["Relay", "Yield"], function(o) {