Skip to content

Commit 035989c

Browse files
committed
Only allow current player to pass
1 parent 3bc11ae commit 035989c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/server/server.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,17 @@ handlers[SET] = function(client, data) {
306306
// tell the client the move failed
307307
sendStone(client, x, y);
308308
}
309-
}
309+
};
310310

311-
handlers[TURN] = switchTurn;
311+
handlers[TURN] = function (client) {
312+
if (client.color == currentPlayer) {
313+
switchTurn();
314+
}
315+
};
312316

313317
handlers[RESET] = function () {
314318
startGame();
315319
forAllClients(sendBoard);
316320
forAllClients(sendScore);
317321
forAllClients(sendTurn);
318-
}
322+
};

0 commit comments

Comments
 (0)