Permalink
Browse files

Don't start the same game more than once.

  • Loading branch information...
1 parent 99d573e commit 4317a6713175e9121e46623b898fb91b4d39d05c @dripton committed Feb 20, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 slugathon/gui/WaitingForPlayers.py
@@ -37,6 +37,7 @@ def __init__(self, user, username, game, parent):
self.username = username
self.game = game
self.game.add_observer(self)
+ self.started = False
self.set_icon(icon.pixbuf)
self.set_transient_for(parent)
@@ -143,8 +144,13 @@ def cb_click_drop(self, widget, event):
self.destroy()
def cb_click_start(self, widget, event):
- def1 = self.user.callRemote("start_game", self.game.name)
- def1.addErrback(self.failure)
+ self.start_game()
+
+ def start_game(self):
+ if not self.started:
+ self.started = True
+ def1 = self.user.callRemote("start_game", self.game.name)
+ def1.addErrback(self.failure)
# TODO Save the selection and do something useful with it.
def cb_player_list_select(self, path, unused):
@@ -158,14 +164,12 @@ def update_countdown(self):
self.countdown_entry.set_text(label)
if diff > 0:
if self.game.num_players >= self.game.max_players:
- def1 = self.user.callRemote("start_game", self.game.name)
- def1.addErrback(self.failure)
+ self.start_game()
else:
reactor.callLater(1, self.update_countdown)
else:
if self.game.num_players >= self.game.min_players:
- def1 = self.user.callRemote("start_game", self.game.name)
- def1.addErrback(self.failure)
+ self.start_game()
def update_player_store(self):
length = len(self.player_store)

0 comments on commit 4317a67

Please sign in to comment.