fix replay when black starts from FEN position

This commit is contained in:
Jimmie Elvenmark 2014-12-21 03:06:50 +01:00
parent d96ae9535b
commit e08357af5d
2 changed files with 2 additions and 2 deletions

View file

@ -56,7 +56,7 @@ module.exports = function(cfg, router, i18n, onChange) {
move = moves[ply - 1];
hash += move;
lm = chess.move(move);
var turnColor = ply % 2 === 1 ? 'black' : 'white';
var turnColor = chess.turn() == 'w' ? 'white' : 'black';
situationCache[hash] = {
fen: chess.fen(),
turnColor: turnColor,

View file

@ -40,7 +40,7 @@ module.exports = function(root) {
fen: chess.fen(),
check: chess.in_check(),
lastMove: [lm.from, lm.to],
turnColor: ply % 2 === 0 ? 'white' : 'black'
turnColor: chess.turn() == 'w' ? 'white' : 'black'
};
}
}