aboutsummaryrefslogtreecommitdiff
path: root/src/components/MultiplayerGrid.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-07-24 18:14:26 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-07-24 18:14:26 +0530
commitb353dda4df7fc7be973e52a2f529360e7bfc8fed (patch)
tree95f270639f3a2fc6aa936961d9787a59a63b079e /src/components/MultiplayerGrid.js
parentb204876cfd803fc115029ac6501c67657dcec19e (diff)
Added menu to host/join game and protection against cheating
Diffstat (limited to 'src/components/MultiplayerGrid.js')
-rw-r--r--src/components/MultiplayerGrid.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/components/MultiplayerGrid.js b/src/components/MultiplayerGrid.js
index d26fb31..88a8259 100644
--- a/src/components/MultiplayerGrid.js
+++ b/src/components/MultiplayerGrid.js
@@ -29,6 +29,9 @@ const MultiplayerGrid = (props) => {
const turn = props.turn;
const getBoard = (index) => {
+ // if it's not your turn you can't play
+ if ((turn === 0) === props.isHost) return;
+
const newBoard = board.slice(0, index).concat(turn).concat(board.slice(index+1, 9));
socket.emit("update-remote-data", {
board: newBoard,