X-Git-Url: https://git.ucc.asn.au/?p=progcomp2013.git;a=blobdiff_plain;f=qchess%2Fsrc%2Fgame.py;h=09c73c22b34f6da99911921299335e10a58d5ba6;hp=4eebc76af62acbee1f8113fa9f476383300ebc46;hb=f7cca7e99d39a6b04b605e988d182a9b8a9e4be3;hpb=a6d91c8bb286fa91f9e2a56b304043ff48154322 diff --git a/qchess/src/game.py b/qchess/src/game.py index 4eebc76..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,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