summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-10-23 14:46:24 +0200
committertomsmeding <hallo@tomsmeding.nl>2015-10-23 14:46:24 +0200
commit5ce2c95fd8703156895e335c023b654bc7570fb6 (patch)
treec7ac00565793b2965a54b17103fec1a513353f98
parent637992c80f39d781d00ab903466c681d1c82159d (diff)
1
-rw-r--r--interactor/index.html17
1 files 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("<b>Your turn!</b>");
}
@@ -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("<b>Player "+(player+1)+" won</b>");