better set round player presence

in some case of bot challenge,
a message without 'black' and 'white'
can be received.
It's from the challenge page with same ID.
pull/7384/head
Thibault Duplessis 2020-09-29 22:57:10 +02:00
parent 5f6e2026d0
commit 26c19f4831
1 changed files with 4 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import * as xhr from './xhr';
import * as sound from './sound';
import RoundController from './ctrl';
import { Untyped } from './interfaces';
import {defined} from 'common';
export interface RoundSocket extends Untyped {
send: SocketSend;
@ -96,8 +97,9 @@ export function make(send: SocketSend, ctrl: RoundController): RoundSocket {
}
},
crowd(o) {
game.setOnGame(ctrl.data, 'white', o['white']);
game.setOnGame(ctrl.data, 'black', o['black']);
['white', 'black'].forEach(c => {
if (defined(o[c])) game.setOnGame(ctrl.data, c as Color, o[c]);
});
ctrl.redraw();
},
endData: ctrl.endWithData,