use autoswitch in correspondence games only
This commit is contained in:
parent
a6a5343f5b
commit
043a40ff3d
|
@ -83,6 +83,10 @@ function forecastable(data) {
|
|||
return playable(data) && data.correspondence && !hasAi(data) && !isPlayerTurn(data);
|
||||
}
|
||||
|
||||
function isCorrespondence(data) {
|
||||
return data.game.speed === 'correspondence';
|
||||
}
|
||||
|
||||
function setOnGame(data, color, onGame) {
|
||||
var player = getPlayer(data, color);
|
||||
onGame = onGame || player.ai;
|
||||
|
@ -118,5 +122,6 @@ module.exports = {
|
|||
nbMoves: nbMoves,
|
||||
setOnGame: setOnGame,
|
||||
setIsGone: setIsGone,
|
||||
forecastable: forecastable
|
||||
forecastable: forecastable,
|
||||
isCorrespondence: isCorrespondence
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = function(ctrl, key) {
|
|||
};
|
||||
|
||||
this.next = function(force) {
|
||||
if (!this.value || ctrl.data.player.spectator || ctrl.data.game.tournamentId || game.isPlayerTurn(ctrl.data)) return;
|
||||
if (!this.value || ctrl.data.player.spectator || !game.isCorrespondence(ctrl.data) || game.isPlayerTurn(ctrl.data)) return;
|
||||
if (force) redirect('/round-next/' + ctrl.data.game.id);
|
||||
else if (ctrl.data.simul) {
|
||||
if (ctrl.data.simul.hostId === ctrl.userId && ctrl.data.simul.nbPlaying > 1)
|
||||
|
|
Loading…
Reference in a new issue