Browse Source

fixed issue with connecting too many players to one game

Roman Matiasko 10 years ago
parent
commit
0b3f9352d2

BIN
.DS_Store


+ 3 - 1
README.md

@@ -1,7 +1,9 @@
 Reti Chess
 ==========
 
-Reti Chess is opensource chess app built in [Node.js](http://nodejs.org/) with use of [Express framework](http://expressjs.com/) and [Socket.IO](http://socket.io/). Reti Chess also uses [chess.js](https://github.com/jhlywa/chess.js) for move validation and check/mate/draw detection.
+Reti Chess is an open source chess app built in [Node.js](http://nodejs.org/) with use of [Express framework](http://expressjs.com/) and [Socket.IO](http://socket.io/). Reti Chess also uses [chess.js](https://github.com/jhlywa/chess.js) for move validation and check/mate/draw detection.
+
+It's currently hosted on [retichess.nodejitsu.com](http://retichess.nodejitsu.com/)
 
 Why another online chess?
 -------------------------

+ 1 - 1
app.js

@@ -74,7 +74,7 @@ io.sockets.on('connection', function (socket) {
 
     game = games[data.token];
 
-    if (game.players.length > 2) {
+    if (game.players.length >= 2) {
       socket.emit('full');
       return;
     } else if (game.players.length == 1) {

BIN
node_modules/.DS_Store


BIN
node_modules/socket.io/.DS_Store


BIN
node_modules/socket.io/node_modules/.DS_Store


BIN
node_modules/socket.io/node_modules/socket.io-client/.DS_Store


+ 6 - 3
package.json

@@ -1,13 +1,16 @@
 {
   "name": "retichess",
-  "version": "0.0.1",
-  "private": true,
+  "version": "0.0.1-3",
   "scripts": {
-    "start": "node app"
+    "start": "app.js"
   },
   "dependencies": {
     "express": "~3.3.0",
     "jade": "~0.28.2",
     "socket.io": "~0.9.16"
+  },
+  "subdomain": "retichess",
+  "engines": {
+    "node": "0.8.x"
   }
 }

BIN
public/.DS_Store


BIN
public/javascripts/.DS_Store


+ 6 - 1
public/javascripts/play.js

@@ -208,7 +208,12 @@ $(document).ready(function () {
   });
 
   $socket.on('opponent-disconnected', function (data) {
-    alert("Your opponent has disconnected");
+    alert("Your opponent has disconnected.");
+    window.location = '/';
+  });
+
+  $socket.on('full', function (data) {
+    alert("This game already has two players. You have to create a new one.");
     window.location = '/';
   });
 });

BIN
public/javascripts/socket.io/.DS_Store


+ 1 - 1
views/layout.jade

@@ -4,7 +4,7 @@ html
     - if (typeof(title) !== 'undefined')
       title #{title} | Reti Chess
     - else
-      title retichess.com
+      title Reti Chess
     meta(charset='utf-8')
     meta(name='robots', content='index, follow')
     meta(itemprop='name=Reti Chess')