mirror of
https://github.com/DeNNiiInc/Connect-5.git
synced 2026-04-17 22:46:00 +00:00
Fix: Add opponentId to game_started events for surrender/rematch functionality
- Added opponentId field to both game_started socket emissions in acceptChallenge - This allows client to properly track opponent for rematch requests - Fixes surrender button not showing issue (client needs opponentId to enable features)
This commit is contained in:
@@ -236,6 +236,7 @@ class GameManager {
|
|||||||
this.io.to(challengerSocket).emit('game_started', {
|
this.io.to(challengerSocket).emit('game_started', {
|
||||||
gameId: gameId,
|
gameId: gameId,
|
||||||
opponent: challenge.targetUsername,
|
opponent: challenge.targetUsername,
|
||||||
|
opponentId: challenge.targetId,
|
||||||
yourSymbol: gameData.player1Symbol,
|
yourSymbol: gameData.player1Symbol,
|
||||||
boardSize: challenge.boardSize,
|
boardSize: challenge.boardSize,
|
||||||
yourTurn: true
|
yourTurn: true
|
||||||
@@ -245,6 +246,7 @@ class GameManager {
|
|||||||
this.io.to(socket.id).emit('game_started', {
|
this.io.to(socket.id).emit('game_started', {
|
||||||
gameId: gameId,
|
gameId: gameId,
|
||||||
opponent: challenge.challengerUsername,
|
opponent: challenge.challengerUsername,
|
||||||
|
opponentId: challenge.challengerId,
|
||||||
yourSymbol: gameData.player2Symbol,
|
yourSymbol: gameData.player2Symbol,
|
||||||
boardSize: challenge.boardSize,
|
boardSize: challenge.boardSize,
|
||||||
yourTurn: false
|
yourTurn: false
|
||||||
|
|||||||
Reference in New Issue
Block a user