Fix: Enable Chess960 mode in chess.js for FEN parsing
All checks were successful
Build and Push / build-all (push) Successful in 1m53s
All checks were successful
Build and Push / build-all (push) Successful in 1m53s
This commit is contained in:
parent
87e6d3ede9
commit
e52f3b7cc7
1 changed files with 5 additions and 4 deletions
|
|
@ -73,6 +73,7 @@
|
||||||
try {
|
try {
|
||||||
const chessModule = await import('chess.js');
|
const chessModule = await import('chess.js');
|
||||||
Chess = chessModule.Chess;
|
Chess = chessModule.Chess;
|
||||||
|
// Don't initialize with default position - we'll load Chess960 FEN later
|
||||||
game = new Chess();
|
game = new Chess();
|
||||||
|
|
||||||
// Set up match event handler
|
// Set up match event handler
|
||||||
|
|
@ -127,7 +128,7 @@
|
||||||
|
|
||||||
// Load the Chess960 starting position
|
// Load the Chess960 starting position
|
||||||
if (game && payload.fen) {
|
if (game && payload.fen) {
|
||||||
game.load(payload.fen);
|
game.load(payload.fen, { chess960: true });
|
||||||
updateBoardDisplay();
|
updateBoardDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,7 +144,7 @@
|
||||||
myColor = payload.whiteId === session?.user_id ? 'w' : 'b';
|
myColor = payload.whiteId === session?.user_id ? 'w' : 'b';
|
||||||
|
|
||||||
if (game) {
|
if (game) {
|
||||||
game.load(payload.fen);
|
game.load(payload.fen, { chess960: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
gamesOverlay.setMode('playing');
|
gamesOverlay.setMode('playing');
|
||||||
|
|
@ -163,7 +164,7 @@
|
||||||
myColor = null; // Spectator has no color
|
myColor = null; // Spectator has no color
|
||||||
|
|
||||||
if (game) {
|
if (game) {
|
||||||
game.load(payload.fen);
|
game.load(payload.fen, { chess960: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
gamesOverlay.setMode('spectating');
|
gamesOverlay.setMode('spectating');
|
||||||
|
|
@ -183,7 +184,7 @@
|
||||||
|
|
||||||
function handleOpponentMove(payload) {
|
function handleOpponentMove(payload) {
|
||||||
if (game) {
|
if (game) {
|
||||||
game.load(payload.fen);
|
game.load(payload.fen, { chess960: true });
|
||||||
}
|
}
|
||||||
moveHistory = [...moveHistory, payload.move];
|
moveHistory = [...moveHistory, payload.move];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue