projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused move.color, format moves corr --> live after retrieval
[vchess.git]
/
client
/
src
/
views
/
Game.vue
diff --git
a/client/src/views/Game.vue
b/client/src/views/Game.vue
index
b66c6ef
..
cb00856
100644
(file)
--- a/
client/src/views/Game.vue
+++ b/
client/src/views/Game.vue
@@
-349,6
+349,7
@@
export default {
game.clocks = [tc.mainTime, tc.mainTime];
game.initime = [0, 0];
const L = game.moves.length;
game.clocks = [tc.mainTime, tc.mainTime];
game.initime = [0, 0];
const L = game.moves.length;
+ game.moves.sort((m1,m2) => m1.idx - m2.idx); //in case of
if (L >= 3)
{
let addTime = [0, 0];
if (L >= 3)
{
let addTime = [0, 0];
@@
-362,6
+363,18
@@
export default {
}
if (L >= 1)
game.initime[L%2] = game.moves[L-1].played;
}
if (L >= 1)
game.initime[L%2] = game.moves[L-1].played;
+ // Now that we used idx and played, re-format moves as for live games
+ game.moves = game.moves.map(m => {
+ const s = m.squares;
+ return
+ {
+ appear: s.appear,
+ vanish: s.vanish,
+ start: s.start,
+ end: s.end,
+ message: m.message,
+ };
+ });
}
const myIdx = game.players.findIndex(p => {
return p.sid == this.st.user.sid || p.uid == this.st.user.id;
}
const myIdx = game.players.findIndex(p => {
return p.sid == this.st.user.sid || p.uid == this.st.user.id;
@@
-452,8
+465,7
@@
export default {
squares: filtered_move,
message: this.corrMsg, //TODO
played: Date.now(), //TODO: on server?
squares: filtered_move,
message: this.corrMsg, //TODO
played: Date.now(), //TODO: on server?
- idx: this.game.moves.length - 1,
- color: move.color,
+ idx: this.game.moves.length,
},
clocks: this.game.clocks.map((t,i) => i==colorIdx
? this.game.clocks[i] + addTime
},
clocks: this.game.clocks.map((t,i) => i==colorIdx
? this.game.clocks[i] + addTime