Changes to Networking code
[progcomp2013.git] / qchess / src / game.py
index 4eebc76..09c73c2 100644 (file)
@@ -24,8 +24,8 @@ class GameThread(StoppableThread):
                        
                        for p in self.players:
                                with self.lock:
-                                       if isinstance(p, NetworkSender):
-                                               self.state["turn"] = p.base_player # "turn" contains the player who's turn it is
+                                       if isinstance(p, Network) and p.baseplayer != None:
+                                               self.state["turn"] = p.baseplayer # "turn" contains the player who's turn it is
                                        else:
                                                self.state["turn"] = p
                                #try:
@@ -33,11 +33,13 @@ class GameThread(StoppableThread):
                                        [x,y] = p.select() # Player selects a square
                                        if self.stopped():
                                                break
-
-                                       
                                                
-
-                                       result = self.board.select(x, y, colour = p.colour)                             
+                                       if isinstance(p, Network) == False or p.server == True:
+                                               result = self.board.select(x, y, colour = p.colour)
+                                       else:
+                                               result = p.get_response()
+                                               self.board.update(result)
+                                               
                                        for p2 in self.players:
                                                p2.update(result) # Inform players of what happened
 

UCC git Repository :: git.ucc.asn.au