From 3b983b522779cdfd47f179fcdee2439dd428edd6 Mon Sep 17 00:00:00 2001 From: Didictateur Date: Sat, 22 Nov 2025 16:16:30 +0100 Subject: [PATCH] fixe affichage des mouvements --- server.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 671f6cb..cc93654 100644 --- a/server.js +++ b/server.js @@ -527,8 +527,16 @@ io.on('connection', (socket) => { console.error('computeLegalMoves error', e); moves = []; } - // broadcast selection + moves to ALL clients in the room (including sender) - io.to(roomId).emit('game:select', { playerId, square, moves }); + // send selection to the selecting client WITH moves, but broadcast selection WITHOUT moves to other clients + try{ + // send to selecting socket (include moves) + socket.emit('game:select', { playerId, square, moves }); + // notify other sockets in the room about the selection but without revealing the legal moves + socket.to(roomId).emit('game:select', { playerId, square, moves: [] }); + }catch(e){ + // fallback: broadcast to all (shouldn't normally happen) + io.to(roomId).emit('game:select', { playerId, square, moves: [] }); + } cb && cb({ ok: true }); });