From 5ce2c95fd8703156895e335c023b654bc7570fb6 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 23 Oct 2015 14:46:24 +0200 Subject: 1 --- interactor/index.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/interactor/index.html b/interactor/index.html index afda76c..ff2edf4 100644 --- a/interactor/index.html +++ b/interactor/index.html @@ -180,10 +180,6 @@ function queueapplymove(idx,c){ } function getusermove(){ - if(applymove_busy)applymove_queue.push(_getusermove); - else _getusermove(); -} -function _getusermove(){ usercanmove=true; setstatustext("Your turn!"); } @@ -206,11 +202,18 @@ socket.on("alert",function(text){ alert(text); }); socket.on("setonturn",function(player){ - onturn=player; - drawboard(bd,onturn); + if(applymove_busy)applymove_queue.push(function(){ + onturn=player; + drawboard(bd,onturn); + }); + else { + onturn=player; + drawboard(bd,onturn); + } }); socket.on("getusermove",function(){ - getusermove(); + if(applymove_busy)applymove_queue.push(getusermove); + else getusermove(); }); socket.on("win",function(player){ setstatustext("Player "+(player+1)+" won"); -- cgit v1.2.3-70-g09d2