X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=563ecd306c18e45981e0b8895ac7c17c80a53945;hp=e76139a183cc74c91d61380b317952cb72318034;hb=4b0384faf03d3842ba2f80ccd6d104c5e34a355e;hpb=834c202a003ca6285106133336701b340939ba12 diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index e76139a1..563ecd30 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -78,7 +78,7 @@ import { NbPlayers } from "@/data/nbPlayers"; import { checkChallenge } from "@/data/challengeCheck"; import { ArrayFun } from "@/utils/array"; import { ajax } from "@/utils/ajax"; -import { getRandString } from "@/utils/alea"; +import { getRandString, shuffle } from "@/utils/alea"; import GameList from "@/components/GameList.vue"; import ChallengeList from "@/components/ChallengeList.vue"; import { GameStorage } from "@/utils/storage"; @@ -564,11 +564,14 @@ export default { window.V = vModule.VariantRules; let players = [c.from]; Array.prototype.push.apply(players, c.seats); - let gameInfo = + // These game informations will be sent to other players + const gameInfo = { + gameId: getRandString(), fen: c.fen || V.GenRandInitFen(), // Players' names may be required if game start when a player is offline - players: players.map(p => { return {name:p.name, sid:p.sid} }), + // Shuffle players order (white then black then other colors). + players: shuffle(players.map(p => { return {name:p.name, sid:p.sid} })), vid: c.vid, timeControl: c.timeControl, }; @@ -584,7 +587,7 @@ export default { // NOTE: for live games only (corr games are launched on server) newGame: function(gameInfo) { GameStorage.init({ - gameId: getRandString(), + gameId: gameInfo.gameId, vname: this.getVname(gameInfo.vid), fenStart: gameInfo.fen, players: gameInfo.players,