- game.chats.sort( (c1,c2) => { return c2.added - c1.added; });
- if (myIdx >= 0 && game.chats.length > 0)
- {
- // TODO: group multi-moves into an array, to deduce color from index
- // and not need this (also repeated in BaseGame::re_setVariables())
- let vr_tmp = new V(game.fenStart); //vr is already at end of game
- for (let i=0; i<reformattedMoves.length; i++)
- {
- game.moves[i].color = vr_tmp.turn;
- vr_tmp.play(reformattedMoves[i]);
- }
- // Blue background on chat button if last chat message arrived after my last move.
+ game.chats.sort((c1, c2) => {
+ return c2.added - c1.added;
+ });
+ 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