Permalink
Browse files

Better error checks in form_game

  • Loading branch information...
1 parent 536e693 commit 2127c7b75cb3d38666906f3356e1ed2f28718613 @dripton committed Aug 16, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 slugathon/net/Server.py
View
@@ -136,17 +136,19 @@ def form_game(self, playername, game_name, min_players, max_players,
game_name, min_players, max_players, ai_time_limit,
player_time_limit, player_class, player_info)
if not game_name:
- logging.warning("Games must be named")
- return
+ st = "Games must be named"
+ logging.warning(st)
+ return st
game_info_tuples = self.get_game_info_tuples()
game_names = set((tup[0] for tup in game_info_tuples))
if game_name in game_names:
st = 'The game name "%s" is already in use' % game_name
logging.warning(st)
return st
if min_players > max_players:
- logging.warning("min_players must be <= max_players")
- return
+ st = "min_players must be <= max_players"
+ logging.warning(st)
+ return st
now = time.time()
GAME_START_DELAY = 5 * 60
game = Game.Game(game_name, playername, now, now + GAME_START_DELAY,

0 comments on commit 2127c7b

Please sign in to comment.