X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=d8f06b3358bb6156981689796c4db98c58d6f30e;hp=1a3d2379c11a49fb6d7074d051934c8d6eb31a47;hb=78bab51e57306ae9085d83828bbb73b62dd83fd8;hpb=6e62b1c7d177585003e923d423025dff280a7525 diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 1a3d2379..d8f06b33 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -1120,6 +1120,8 @@ Vue.component('my-game', { const self = this; this.compWorker.onmessage = function(e) { let compMove = e.data; + if (!compMove) + return; //may happen if MarseilleRules and subTurn==2 (TODO: a bit ugly...) if (!Array.isArray(compMove)) compMove = [compMove]; //to deal with MarseilleRules // TODO: imperfect attempt to avoid ghost move: @@ -1133,8 +1135,8 @@ Vue.component('my-game', { if (compMove.length == 2) setTimeout( () => { if (self.mode == "computer") - self.play(compMove[1]); - }, 2000); + self.play(compMove[1], "animate"); + }, 750); }, delay); } },