projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
'update'
[vchess.git]
/
client
/
src
/
utils
/
storage.js
diff --git
a/client/src/utils/storage.js
b/client/src/utils/storage.js
index
f5c3b25
..
ecafe20
100644
(file)
--- a/
client/src/utils/storage.js
+++ b/
client/src/utils/storage.js
@@
-99,7
+99,7
@@
export const GameStorage =
fen: o.fenStart,
moves: [],
clocks: [...Array(o.players.length)].fill(tc.mainTime),
fen: o.fenStart,
moves: [],
clocks: [...Array(o.players.length)].fill(tc.mainTime),
-
started: [...Array(o.players.length)].fill(false)
,
+
initime: undefined
,
score: "*",
};
score: "*",
};
@@
-123,7
+123,8
@@
export const GameStorage =
{
gameState.moves.push(o.move);
gameState.fen = o.fen;
{
gameState.moves.push(o.move);
gameState.fen = o.fen;
- gameState.clocks[o.colorIdx] += (o.increment - o.elapsed);
+ if (!!o.elapsed) //NaN if first move in game
+ gameState.clocks[o.colorIdx] += (o.increment - o.elapsed);
}
if (!!o.initime) //just a flag (true)
gameState.initime = Date.now();
}
if (!!o.initime) //just a flag (true)
gameState.initime = Date.now();
@@
-168,7
+169,7
@@
export const GameStorage =
callback({}); //everything's fine
}
transaction.onerror = function() {
callback({}); //everything's fine
}
transaction.onerror = function() {
- callback({errmsg: "
deleteGame
failed: " + transaction.error});
+ callback({errmsg: "
game removal
failed: " + transaction.error});
};
}
transaction.objectStore("games").delete(gameId);
};
}
transaction.objectStore("games").delete(gameId);