From 214dd5f0cb01ace32a591f85bd2ec4d7f9cbf3de Mon Sep 17 00:00:00 2001 From: ksthicke <85892703+ksthicke@users.noreply.github.com> Date: Thu, 2 May 2024 21:07:54 -0500 Subject: [PATCH] fix cpForWhiteStr --- src/renderer/store.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/renderer/store.js b/src/renderer/store.js index 9932c41d..20f4f311 100644 --- a/src/renderer/store.js +++ b/src/renderer/store.js @@ -1314,12 +1314,8 @@ export const store = new Vuex.Store({ // if the SAN in the pgn is the same than the SAN in states.moves // and we are at the last move, return pgn result if (state.selectedGame) { - let pgnBoard - if (state.selectedGame.headers('FEN')) { - pgnBoard = new ffish.Board(state.variant, state.selectedGame.headers('FEN')) - } else { - pgnBoard = state.board - } + let pgnBoard = new ffish.Board(state.variant, state.startFen) + const pgnMoves = state.selectedGame.mainlineMoves() const san = pgnBoard.variationSan(pgnMoves, ffish.Notation.SAN, false) let str = '' @@ -1334,10 +1330,8 @@ export const store = new Vuex.Store({ if (typeof mate === 'number') { return `#${calcForSide(mate, state.turn)}` - } else if (currentMove && currentMove.name.includes('#')) { - return state.turn ? '0-1' : '1-0' - } else if (state.legalMoves.length === 0) { - return '1/2-1/2' + } else if (state.board != null && state.board.isGameOver()) { + return state.board.result() } else { return cpToString(getters.cpForWhite) }