X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;fp=public%2Fjavascripts%2Fbase_rules.js;h=6cdae328470d4eb285c13d486d16ace0b3791013;hb=388e4c401f05b1f6a4c54e33c9da9114969a53c0;hp=d85ff869a22eea9ba8e841040efc3734ea889ccb;hpb=375ecdd1387e729f85ed114e82253469e4849869;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index d85ff869..6cdae328 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -994,12 +994,12 @@ class ChessRules if (V.HasFlags) move.flags = JSON.stringify(this.aggregateFlags()); //save flags (for undo) - this.updateVariables(move); - this.moves.push(move); if (V.HasEnpassant) this.epSquares.push( this.getEpSquare(move) ); - this.turn = this.getOppCol(this.turn); V.PlayOnBoard(this.board, move); + this.turn = this.getOppCol(this.turn); + this.moves.push(move); + this.updateVariables(move); if (!!ingame) { @@ -1010,14 +1010,14 @@ class ChessRules undo(move) { - V.UndoOnBoard(this.board, move); - this.turn = this.getOppCol(this.turn); if (V.HasEnpassant) this.epSquares.pop(); - this.moves.pop(); - this.unupdateVariables(move); if (V.HasFlags) this.disaggregateFlags(JSON.parse(move.flags)); + V.UndoOnBoard(this.board, move); + this.turn = this.getOppCol(this.turn); + this.moves.pop(); + this.unupdateVariables(move); // DEBUG: // if (this.getFen() != this.states[this.states.length-1])