- // Sending last state only for live games: corr games are complete,
- // only if I played a move (otherwise opponent has all)
- if (!!this.game.mycolor && this.game.type == "live"
- && this.game.oppsid == data.user.sid
- && this.game.moves.length > 0 && this.vr.turn != this.game.mycolor)
+ // Ask potentially missed last state, if opponent and I play
+ if (!!this.game.mycolor
+ && this.game.type == "live" && this.game.score == "*"
+ && this.game.players.some(p => p.sid == data.user.sid))
+ {
+ this.st.conn.send(JSON.stringify({code:"asklastate", target:data.user.sid}));
+ }
+ break;
+ }
+ case "asklastate":
+ {
+ // Sending last state if I played a move or score != "*"
+ if ((this.game.moves.length > 0 && this.vr.turn != this.game.mycolor)
+ || this.game.score != "*")