X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=qchess%2Fsrc%2Fgame.py;fp=qchess%2Fsrc%2Fgame.py;h=09c73c22b34f6da99911921299335e10a58d5ba6;hp=8b279fb9f5fad1e037c691d75b0791a284f4d20e;hb=f7cca7e99d39a6b04b605e988d182a9b8a9e4be3;hpb=7a6c3dd98ba430b9bcdf95b7a92100cb7c0a1bbe diff --git a/qchess/src/game.py b/qchess/src/game.py index 8b279fb..09c73c2 100644 --- a/qchess/src/game.py +++ b/qchess/src/game.py @@ -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,17 +33,15 @@ class GameThread(StoppableThread): [x,y] = p.select() # Player selects a square if self.stopped(): break - - if not (isinstance(p, Network) and p.server == False): + + if isinstance(p, Network) == False or p.server == True: result = self.board.select(x, y, colour = p.colour) else: - #debug(str(self) + " don't update local board") - result = "" - - result = p.update(result) + result = p.get_response() + self.board.update(result) + for p2 in self.players: - if p2 != p: - result = p2.update(result) # Inform players of what happened + p2.update(result) # Inform players of what happened log(result)