Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dripton/Slugathon
base: 866ce82767
...
head fork: dripton/Slugathon
compare: 143413cce9
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 10 additions and 4 deletions.
  1. +1 −1  slugathon/net/Results.py
  2. +9 −3 slugathon/net/Server.py
View
2  slugathon/net/Results.py
@@ -216,7 +216,6 @@ def get_player_info(self, player_id):
def get_player_id(self, player_info):
"""Return the player_id for player_info, from the database."""
- logging.info(player_info)
with self.connection:
cursor = self.connection.cursor()
# See if that player is already in the database
@@ -224,6 +223,7 @@ def get_player_id(self, player_info):
cursor.execute(query, (player_info,))
row = cursor.fetchone()
if row is None:
+ logging.debug("returning None")
return None
return row["player_id"]
View
12 slugathon/net/Server.py
@@ -132,8 +132,8 @@ def form_game(self, playername, game_name, min_players, max_players,
Return None normally, or an error string if there's a problem.
"""
- logging.info("form_game %s %s %s %s %s %s %s %s", playername,
- game_name, min_players, max_players, ai_time_limit,
+ logging.info("%s %s %s %s %s %s %s %s", playername, game_name,
+ min_players, max_players, ai_time_limit,
player_time_limit, player_class, player_info)
if not game_name:
st = "Games must be named"
@@ -229,6 +229,12 @@ def _spawn_ais(self, game):
for player in game.players:
player_id = self.results.get_player_id(player.player_info)
player_ids.add(player_id)
+ for game_name, waiting_ais in self.game_to_waiting_ais.iteritems():
+ game2 = self.name_to_game(game_name)
+ if game2 and not game2.over and game2 != game:
+ for ainame in waiting_ais:
+ player_id = int(ainame[2:])
+ player_ids.add(player_id)
logging.debug("min_players %d", game.min_players)
logging.debug("num_players %d", game.num_players)
num_ais = game.min_players - game.num_players
@@ -249,7 +255,7 @@ def _spawn_ais(self, game):
for ainame in ainames:
if self._passwd_for_playername(ainame) is None:
self._add_playername_with_random_password(ainame)
- logging.debug("ainames %s", ainames)
+ logging.debug("game %s ainames %s", game.name, ainames)
self.game_to_waiting_ais[game.name] = set()
# Add all AIs to the wait list first, to avoid a race.
for ainame in ainames:

No commit comments for this range

Something went wrong with that request. Please try again.