Bugfix : code wasn't comparing the game coordinates
This commit is contained in:
parent
c5e5a7c958
commit
fb3bb64ff6
1 changed files with 6 additions and 4 deletions
|
@ -40,10 +40,12 @@ function initMessageHandlers() {
|
||||||
Messaging.addEventListener(["Relay", "Sync"], function(o) {
|
Messaging.addEventListener(["Relay", "Sync"], function(o) {
|
||||||
var gameID = o.message.latestKnown.gameID;
|
var gameID = o.message.latestKnown.gameID;
|
||||||
var state = states.get(gameID);
|
var state = states.get(gameID);
|
||||||
switch(state != undefined && compare(state.latest, o.message.latestKnown)) {
|
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: "Yield", onGameID: gameID});
|
||||||
case 1: Messaging.send({tag: "Share", gameSave: state.latest});
|
case 1: Messaging.send({tag: "Share", gameSave: state.latest});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Messaging.addEventListener(["Relay", "Yield"], function(o) {
|
Messaging.addEventListener(["Relay", "Yield"], function(o) {
|
||||||
|
|
Loading…
Reference in a new issue