Only log ranking games in db.

This commit is contained in:
lotodore
2010-07-23 22:16:19 +00:00
parent d6c8d39afe
commit 5e9c33e7ff
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -270,7 +270,8 @@ ServerGame::InternalStartGame()
m_game.reset(new Game(&gui, factory, playerData, GetGameData(), GetStartData(), GetNextGameNum()));
GetLobbyThread().NotifyStartingGame(GetId());
GetLobbyThread().GetDatabase().AsyncCreateGame(GetId(), GetName());
if (GetGameData().gameType == GAME_TYPE_RANKING)
GetLobbyThread().GetDatabase().AsyncCreateGame(GetId(), GetName());
}
void
+1 -1
View File
@@ -928,7 +928,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
// Store winner in database.
boost::shared_ptr<PlayerInterface> winnerPlayer = *(playersWithCash.begin());
boost::shared_ptr<PlayerData> tmpPlayer = server->GetPlayerDataByUniqueId(winnerPlayer->getMyUniqueID());
if (tmpPlayer)
if (tmpPlayer && server->GetDBId())
{
cerr << "Setting winner for game " << server->GetDBId() << " player id " << tmpPlayer->GetDBId() << endl;
server->GetLobbyThread().GetDatabase().SetGamePlayerPlace(server->GetDBId(), tmpPlayer->GetDBId(), 1);