Skip to content

Commit

Permalink
Fixed bug breaking offline play
Browse files Browse the repository at this point in the history
  • Loading branch information
iByteABit256 committed Mar 30, 2024
1 parent a09fc3e commit 256c48e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tic-tac-toes",
"version": "1.1.0",
"version": "1.1.1",
"main": "/src/index.js",
"scripts": {
"start": "react-scripts start",
Expand Down
1 change: 1 addition & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export default function Game() {
onScoreChange={handleScoreChange}
soundEnabled={shouldPlaySound()}
isItMyTurn={isItMyTurn(playerSymbol)}
onlineMode={online}
receivedOnlineMove={receivedOnlineMove}
/>
</div>,
Expand Down
3 changes: 2 additions & 1 deletion src/board/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function Board({
onScoreChange,
soundEnabled,
isItMyTurn,
onlineMode,
receivedOnlineMove,
}) {
const [winner, setWinner] = useState(null);
Expand Down Expand Up @@ -43,7 +44,7 @@ export default function Board({

function handleClick(i) {
// If not player's turn and online opponent hasn't played, ignore move
if (!isItMyTurn && !receivedOnlineMove) {
if (onlineMode && (!isItMyTurn && !receivedOnlineMove)) {
return;
}

Expand Down

0 comments on commit 256c48e

Please # to comment.