projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a few things: ready to work on basic live games
[vchess.git]
/
client
/
src
/
views
/
Hall.vue
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
94e49a1
..
563ecd3
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-78,9
+78,10
@@
import { NbPlayers } from "@/data/nbPlayers";
import { checkChallenge } from "@/data/challengeCheck";
import { ArrayFun } from "@/utils/array";
import { ajax } from "@/utils/ajax";
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 GameList from "@/components/GameList.vue";
import ChallengeList from "@/components/ChallengeList.vue";
+import { GameStorage } from "@/utils/storage";
export default {
name: "my-hall",
components: {
export default {
name: "my-hall",
components: {
@@
-563,11
+564,14
@@
export default {
window.V = vModule.VariantRules;
let players = [c.from];
Array.prototype.push.apply(players, c.seats);
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
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,
};
vid: c.vid,
timeControl: c.timeControl,
};
@@
-583,7
+587,7
@@
export default {
// NOTE: for live games only (corr games are launched on server)
newGame: function(gameInfo) {
GameStorage.init({
// NOTE: for live games only (corr games are launched on server)
newGame: function(gameInfo) {
GameStorage.init({
- gameId: g
etRandString()
,
+ gameId: g
ameInfo.gameId
,
vname: this.getVname(gameInfo.vid),
fenStart: gameInfo.fen,
players: gameInfo.players,
vname: this.getVname(gameInfo.vid),
fenStart: gameInfo.fen,
players: gameInfo.players,