Fix: neue Züge wurden nicht angezeigt (Brett/Zugliste blieben in Startposition)
This commit is contained in:
@@ -53,7 +53,7 @@ function updateBoard() {
|
|||||||
|
|
||||||
const nonResultMoves = currentGame.moves.filter(m => !m.isResult);
|
const nonResultMoves = currentGame.moves.filter(m => !m.isResult);
|
||||||
|
|
||||||
if (currentMoveIndex >= nonResultMoves.length || currentMoveIndex < -1) {
|
if (currentMoveIndex >= nonResultMoves.length || currentMoveIndex <= -1) {
|
||||||
currentMoveIndex = nonResultMoves.length - 1;
|
currentMoveIndex = nonResultMoves.length - 1;
|
||||||
} else if (previousMoveCount >= 0 && currentMoveIndex === previousMoveCount - 1 && nonResultMoves.length > previousMoveCount) {
|
} else if (previousMoveCount >= 0 && currentMoveIndex === previousMoveCount - 1 && nonResultMoves.length > previousMoveCount) {
|
||||||
currentMoveIndex = nonResultMoves.length - 1;
|
currentMoveIndex = nonResultMoves.length - 1;
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ async function loadPGN(showOverlay = true) {
|
|||||||
const liveGame = getLiveGame(allLaraGames);
|
const liveGame = getLiveGame(allLaraGames);
|
||||||
const todaysGames = getTodaysGames(allLaraGames);
|
const todaysGames = getTodaysGames(allLaraGames);
|
||||||
currentGame = liveGame || (todaysGames.length > 0 ? getLatestGame(todaysGames) : getLatestGame(allLaraGames));
|
currentGame = liveGame || (todaysGames.length > 0 ? getLatestGame(todaysGames) : getLatestGame(allLaraGames));
|
||||||
|
} else if (currentGame) {
|
||||||
|
const updatedGame = allLaraGames.find(g =>
|
||||||
|
g.white === currentGame.white &&
|
||||||
|
g.black === currentGame.black &&
|
||||||
|
g.round === currentGame.round
|
||||||
|
);
|
||||||
|
if (updatedGame) currentGame = updatedGame;
|
||||||
}
|
}
|
||||||
updateBoard();
|
updateBoard();
|
||||||
updatePlayerInfo();
|
updatePlayerInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user