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
/
utils
/
storage.js
diff --git
a/client/src/utils/storage.js
b/client/src/utils/storage.js
index
eb04078
..
48435b5
100644
(file)
--- a/
client/src/utils/storage.js
+++ b/
client/src/utils/storage.js
@@
-1,5
+1,4
@@
import { extractTime } from "@/utils/timeControl";
import { extractTime } from "@/utils/timeControl";
-import { shuffle } from "@/utils/alea";
// TODO: show game structure
//const newItem = [
// TODO: show game structure
//const newItem = [
@@
-79,10
+78,6
@@
export const GameStorage =
// localStorage:
init: function(o)
{
// localStorage:
init: function(o)
{
- // NOTE: when >= 3 players, better use an array + shuffle for mycolor
- const mycolor = (Math.random() < 0.5 ? "w" : "b");
- // Shuffle players order (white then black then other colors).
- const players = shuffle(o.players);
// Extract times (in [milli]seconds), set clocks, store in localStorage
const tc = extractTime(o.timeControl);
// Extract times (in [milli]seconds), set clocks, store in localStorage
const tc = extractTime(o.timeControl);
@@
-91,9
+86,8
@@
export const GameStorage =
{
gameId: o.gameId,
vname: o.vname,
{
gameId: o.gameId,
vname: o.vname,
- mycolor: mycolor,
fenStart: o.fenStart,
fenStart: o.fenStart,
- players: players,
+ players:
o.
players,
timeControl: o.timeControl,
increment: tc.increment,
mode: "live", //function for live games only
timeControl: o.timeControl,
increment: tc.increment,
mode: "live", //function for live games only