- const score = this.vr.getCurrentScore();
- if (score != "*") {
- const message = getScoreMessage(score);
- if (!navigate && this.game.mode != "analyze")
- this.$emit("gameover", score, message);
- // Just show score on screen (allow undo)
- else this.showEndgameMsg(score + " . " + this.st.tr[message]);
- }
- if (!navigate && this.game.mode != "analyze") {
- const L = this.moves.length;
- // Post-processing (e.g. computer play)
- this.$emit("newmove", this.moves[L-1], data);
+ this.score = computeScore();
+ if (this.game.mode != "analyze" && !navigate) {
+ if (!noemit) {
+ // Post-processing (e.g. computer play).
+ const L = this.moves.length;
+ // NOTE: always emit the score, even in unfinished,
+ // to tell Game::processMove() that it's not a received move.
+ this.$emit("newmove", this.moves[L-1], { score: this.score });
+ } else {
+ this.inPlay = false;
+ if (this.stackToPlay.length > 0)
+ // Move(s) arrived in-between
+ this.play(this.stackToPlay.pop(), received, light, noemit);
+ }