Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

From: Christian von Kietzell <christian@vonkietzell.de>
Bug-Debian: http://bugs.debian.org/633838
Forwarded: no
Description: Check whether an existing player is rejoining _before_
 checking whether the maximum of players has been reached.

--- pyscrabble-1.6.2/pyscrabble/net/server.py   2011-07-14 19:32:42.000000000 +0200
+++ pyscrabble-fixed/pyscrabble/net/server.py   2011-07-14 19:35:50.000000000 +0200
@@ -936,21 +936,21 @@
             client.denyJoinGame(command)
             return
         
-        if (game.getNumberOfPlayers() == constants.MAX_PLAYERS):
-            command.setData( ServerMessage([GAME_FULL]) )
-            command.setCommand( constants.GAME_JOIN_DENIED )
-            client.denyJoinGame(command)
-            return
-
         p = self.clients[client].clone()
         
-        if (game.isPaused() and not game.hasPlayer(p)):
-            command.setData( ServerMessage([CANNOT_JOIN_STARTED]) )
-            command.setCommand( constants.GAME_JOIN_DENIED )
-            client.denyJoinGame(command)
-            return
-
         if not game.hasPlayer( p ):
+            if (game.getNumberOfPlayers() == constants.MAX_PLAYERS):
+                command.setData( ServerMessage([GAME_FULL]) )
+                command.setCommand( constants.GAME_JOIN_DENIED )
+                client.denyJoinGame(command)
+                return
+
+            if (game.isPaused()):
+                command.setData( ServerMessage([CANNOT_JOIN_STARTED]) )
+                command.setCommand( constants.GAME_JOIN_DENIED )
+                client.denyJoinGame(command)
+                return
+
             game.addPlayer( p )
         else:
             game.removePending( p )