Fix gameInfo.mycolor in BaseGame
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 21 May 2019 21:49:53 +0000 (23:49 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 21 May 2019 21:49:53 +0000 (23:49 +0200)
client/src/components/BaseGame.vue
client/src/components/ComputerGame.vue

index 1e7a83b..c980400 100644 (file)
@@ -6,8 +6,9 @@
       .card.smallpad.small-modal.text-center
         label.modal-close(for="modalEog")
         h3#eogMessage.section {{ endgameMessage }}
       .card.smallpad.small-modal.text-center
         label.modal-close(for="modalEog")
         h3#eogMessage.section {{ endgameMessage }}
-    Board(:vr="vr" :last-move="lastMove" :analyze="analyze" :user-color="mycolor"
-      :orientation="orientation" :vname="vname" @play-move="play")
+    Board(:vr="vr" :last-move="lastMove" :analyze="analyze"
+      :user-color="gameInfo.mycolor" :orientation="orientation"
+      :vname="vname" @play-move="play")
     .button-group
       button(@click="() => play()") Play
       button(@click="() => undo()") Undo
     .button-group
       button(@click="() => play()") Play
       button(@click="() => undo()") Undo
@@ -55,7 +56,7 @@ export default {
   },
   watch: {
     // fenStart changes when a new game starts
   },
   watch: {
     // fenStart changes when a new game starts
-    fenStart: function() {
+    "gameInfo.fenStart": function() {
       // Reset all variables
       this.endgameMessage = "";
       this.orientation = this.gameInfo.mycolor || "w";
       // Reset all variables
       this.endgameMessage = "";
       this.orientation = this.gameInfo.mycolor || "w";
index 238f109..5ecc1a6 100644 (file)
@@ -100,7 +100,7 @@ export default {
       this.compWorker.postMessage(["newmove",move]);
       // subTurn condition for Marseille (and Avalanche) rules
       if ((!this.vr.subTurn || this.vr.subTurn <= 1)
       this.compWorker.postMessage(["newmove",move]);
       // subTurn condition for Marseille (and Avalanche) rules
       if ((!this.vr.subTurn || this.vr.subTurn <= 1)
-        && (this.mode == "auto" || this.vr.turn != this.mycolor))
+        && (this.mode == "auto" || this.vr.turn != this.gameInfo.mycolor))
       {
         this.playComputerMove();
       }
       {
         this.playComputerMove();
       }