From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 20 Nov 2018 02:03:18 +0000 (+0100)
Subject: Attempt to fix opponent in PGN
X-Git-Url: https://git.auder.net/variants/Chakart/doc/css/current/scripts/index.css?a=commitdiff_plain;h=da2f044481b0eb4d041569149a457365940743aa;p=vchess.git

Attempt to fix opponent in PGN
---

diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js
index 96833bc0..bd66f731 100644
--- a/public/javascripts/components/game.js
+++ b/public/javascripts/components/game.js
@@ -493,10 +493,12 @@ Vue.component('my-game', {
 			this.score = score;
 			let modalBox = document.getElementById("modal-eog");
 			modalBox.checked = true;
-			setTimeout(() => { modalBox.checked = false; }, 2000);
+			setTimeout(() => {
+				modalBox.checked = false;
+				this.mode = "idle"; //TODO: not the best way... (to see correct opponent in PGN)
+			}, 2000);
 			if (this.mode == "human")
 				this.clearStorage();
-			this.mode = "idle";
 			this.oppid = "";
 		},
 		getEndgameMessage: function(score) {
@@ -616,7 +618,6 @@ Vue.component('my-game', {
 				this.oppConnected = true;
 				this.mycolor = color;
 				this.seek = false;
-				this.mode = "human";
 				if (!!moves && moves.length > 0) //imply continuation
 				{
 					const lastMove = moves[moves.length-1];
@@ -629,7 +630,6 @@ Vue.component('my-game', {
 			}
 			else //against computer
 			{
-				this.mode = "computer";
 				this.mycolor = Math.random() < 0.5 ? 'w' : 'b';
 				if (this.mycolor == 'b')
 					setTimeout(this.playComputerMove, 500);