git.ucc.asn.au
/
progcomp2013.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed networking!
[progcomp2013.git]
/
qchess
/
src
/
game.py
diff --git
a/qchess/src/game.py
b/qchess/src/game.py
index
16f26d7
..
8b279fb
100644
(file)
--- a/
qchess/src/game.py
+++ b/
qchess/src/game.py
@@
-33,13
+33,17
@@
class GameThread(StoppableThread):
[x,y] = p.select() # Player selects a square
if self.stopped():
break
[x,y] = p.select() # Player selects a square
if self.stopped():
break
-
+
+ if not (isinstance(p, Network) and p.server == False):
+ result = self.board.select(x, y, colour = p.colour)
+ else:
+ #debug(str(self) + " don't update local board")
+ result = ""
-
-
- result = self.board.select(x, y, colour = p.colour)
+ result = p.update(result)
for p2 in self.players:
for p2 in self.players:
- p2.update(result) # Inform players of what happened
+ if p2 != p:
+ result = p2.update(result) # Inform players of what happened
log(result)
log(result)
@@
-180,6
+184,8
@@
class ReplayThread(GameThread):
if self.stopped():
break
if self.stopped():
break
+ if len(line) <= 0:
+ continue
if line[0] == '#':
if line[0] == '#':
@@
-227,7
+233,10
@@
class ReplayThread(GameThread):
self.board.update_select(x, y, int(tokens[2]), tokens[len(tokens)-1])
if isinstance(graphics, GraphicsThread):
with graphics.lock:
self.board.update_select(x, y, int(tokens[2]), tokens[len(tokens)-1])
if isinstance(graphics, GraphicsThread):
with graphics.lock:
- graphics.state["moves"] = self.board.possible_moves(target)
+ if target.current_type != "unknown":
+ graphics.state["moves"] = self.board.possible_moves(target)
+ else:
+ graphics.state["moves"] = None
time.sleep(turn_delay)
else:
self.board.update_move(x, y, x2, y2)
time.sleep(turn_delay)
else:
self.board.update_move(x, y, x2, y2)
UCC
git Repository :: git.ucc.asn.au