if (myIdx >= 0 && game.chats.length > 0) {
// Did a chat message arrive after my last move?
let vr_tmp = new V(game.fen); //start from last position
+ const flags = V.ParseFen(game.fen).flags; //may be undefined
let dtLastMove = 0;
for (let midx = game.moves.length - 1; midx >= 0; midx--) {
- vr_tmp.undo(game.moves[midx].squares);
+ vr_tmp.undo(Object.assign({flags:flags}, game.moves[midx].squares));
if (vr_tmp.turn == mycolor) {
dtLastMove = game.moves[midx].played;
break;
if (gid.toString().match(/^[0-9]+$/) && GameModel.checkGameUpdate(obj))
{
GameModel.getPlayers(gid, (err,players) => {
- if (players.some(p => p.id == req.userId))
+ if (players.some(p => p.uid == req.userId))
{
GameModel.update(gid, obj);
if (obj.move || obj.score)