diff --git a/src/client/scripts/esm/chess/logic/backcompatible.js b/src/client/scripts/esm/chess/logic/backcompatible.js index 069ce5df..10d67755 100644 --- a/src/client/scripts/esm/chess/logic/backcompatible.js +++ b/src/client/scripts/esm/chess/logic/backcompatible.js @@ -86,9 +86,10 @@ function getLongformatInNewNotation(longformat) { // // koth: 'both' // } // } - const newGameRules = {}; - newGameRules.turnOrder = turnOrder; - if (longformat.gameRules.slideLimit && longformat.gameRules.slideLimit !== "Infinity") newGameRules.slideLimit = longformat.gameRules.slideLimit; + const newGameRules = { + turnOrder, + winConditions: { white: ['checkmate'], black: ['checkmate'] } + }; if (longformat.gameRules.winConditions) { const newWinConditions = { white: [], black: [] }; for (const condition in longformat.gameRules.winConditions) { @@ -103,6 +104,7 @@ function getLongformatInNewNotation(longformat) { // The old gamefiles did not specify promotions allowed, because it's determined by the pieces the game starts with newGameRules.promotionsAllowed = variant.getPromotionsAllowed(longformat.startingPosition, newGameRules.promotionRanks); } + if (longformat.gameRules.slideLimit && longformat.gameRules.slideLimit !== "Infinity") newGameRules.slideLimit = longformat.gameRules.slideLimit; converted.gameRules = newGameRules; } diff --git a/src/client/scripts/esm/chess/logic/formatconverter.js b/src/client/scripts/esm/chess/logic/formatconverter.js index 2cee2170..da97c3b5 100644 --- a/src/client/scripts/esm/chess/logic/formatconverter.js +++ b/src/client/scripts/esm/chess/logic/formatconverter.js @@ -308,7 +308,7 @@ function ShortToLong_Format(shortformat/*, reconstruct_optional_move_flags = tru // Splice the extra gamerules out of the ICN, so that its nested [ and ] don't break the metadata parser shortformat = shortformat.substring(0, indexOfGameRulesStart) + shortformat.substring(indexOfGameRulesEnd + 1, shortformat.length); - if (!isJson(stringifiedExtraGamerules)) throw new Error("Extra optional arguments not in JSON format"); + if (!isJson(stringifiedExtraGamerules)) throw new Error(`Extra optional arguments not in valid JSON format: ${stringifiedExtraGamerules}`); const parsedGameRules = JSON.parse(stringifiedExtraGamerules); Object.assign(longformat.gameRules, parsedGameRules); // Copy over the parsed gamerules to the longformat