- this.gameInProgress = true;
- this.display = "computer";
- this.gameInfo.mode = mode;
- this.gameInfo.score = "*";
- this.gameInfo.fen = V.GenRandInitFen();
+ const next = (game, options) => {
+ this.gameInProgress = true;
+ this.display = "computer";
+ this.gameInfo.mode = mode;
+ this.$refs["compgame"].launchGame(game, options);
+ };
+ if (!!options) {
+ next(null, options);
+ return;
+ }
+ const askOptions = () => {
+ this.whatNext = mode;
+ doClick("modalOptions");
+ };
+ if (mode == "versus") {
+ CompgameStorage.get(this.gameInfo.vname, (game) => {
+ // NOTE: game might be null (if none stored yet)
+ if (!!game && !V.IsGoodFen(game.fen)) {
+ // Some issues with stored game: delete
+ CompgameStorage.remove(game.vname);
+ game = null;
+ }
+ if (!!game || !V.Options) next(game);
+ else askOptions();
+ });
+ }
+ else {
+ if (!V.Options) next();
+ else askOptions();
+ }