summaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rwxr-xr-xindex.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/index.js b/index.js
index a87d6f0..f4f55b2 100755
--- a/index.js
+++ b/index.js
@@ -251,6 +251,12 @@ io.on("connection",function(conn){
return;
}
io.to(roomid).emit("roomgameplace",roomid,pos,playeridx);
+ var win=rooms[roomid].game.checkwin();
+ if(win!=-1){
+ io.to(roomid).emit("roomgamewin",roomid,playeridx);
+ rooms[roomid].game=null;
+ return;
+ }
connlist[findid(rooms[roomid].ids[rooms[roomid].game.onturn])].conn.emit("roomgameturn",roomid,rooms[roomid].game.onturn);
});
});