summaryrefslogtreecommitdiff
path: root/interactor
diff options
context:
space:
mode:
Diffstat (limited to 'interactor')
-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>");