Fix Madrasi rules
[vchess.git] / client / src / views / Game.vue
index 1753df0..2beb10c 100644 (file)
@@ -753,6 +753,8 @@ export default {
           // Got opponent infos about last move
           this.gotLastate = true;
           this.lastate = data.data;
+          if (this.lastate.movesCount - 1 > this.gotMoveIdx)
+            this.gotMoveIdx = this.lastate.movesCount - 1;
           if (this.game.rendered)
             // Game is rendered (Board component)
             this.processLastate();
@@ -760,6 +762,12 @@ export default {
           break;
         }
         case "newmove": {
+
+// DEBUG:
+console.log("Receive move");
+console.log(data.data);
+//moveslist not updated when receiving a move? (see in baseGame)
+
           const movePlus = data.data;
           const movesCount = this.game.moves.length;
           if (movePlus.index > movesCount) {
@@ -1054,7 +1062,7 @@ export default {
         let gameInfo = {
           id: getRandString(), //ignored if corr
           fen: V.GenRandInitFen(this.game.randomness),
-          players: this.game.players.reverse(),
+          players: [this.game.players[1], this.game.players[0]],
           vid: this.game.vid,
           cadence: this.game.cadence
         };
@@ -1265,7 +1273,7 @@ export default {
       this.$nextTick(() => {
         this.game.rendered = true;
         // Did lastate arrive before game was rendered?
-        if (this.lastate) this.processLastate();
+        if (!!this.lastate) this.processLastate();
       });
       if (this.lastateAsked) {
         this.lastateAsked = false;