Working on storing places of all players in ranking games.

This commit is contained in:
lotodore
2010-08-07 23:06:59 +00:00
parent 96b4f864f6
commit 0646bc9d2e
8 changed files with 163 additions and 70 deletions
+5 -6
View File
@@ -655,8 +655,7 @@ ServerGameStateStartGame::DoStart(boost::shared_ptr<ServerGame> server)
else
{
server->InternalStartGame();
if (server->GetGameData().gameType == GAME_TYPE_RANKING)
server->GetLobbyThread().GetDatabase().AsyncCreateGame(server->GetId(), server->GetName());
server->GetDatabase().AsyncCreateGame(server->GetId(), server->GetName());
boost::shared_ptr<NetPacket> packet(new NetPacket(NetPacket::Alloc));
packet->GetMsg()->present = PokerTHMessage_PR_gameStartMessage;
@@ -848,7 +847,7 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
&ServerGameStateHand::TimerComputerAction, this, boost::asio::placeholders::error, server));
}
// If the player we are waiting for left, continue without him.
else if (!server->GetSessionManager().IsPlayerConnected(curPlayer->getMyName()))
else if (!server->GetSessionManager().IsPlayerConnected(curPlayer->getMyUniqueID()))
{
PerformPlayerAction(*server, curPlayer, PLAYER_ACTION_FOLD, 0);
@@ -935,11 +934,11 @@ 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 (server->GetGameData().gameType == GAME_TYPE_RANKING && tmpPlayer && server->GetDBId())
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);
server->GetLobbyThread().GetDatabase().EndGame(server->GetDBId());
server->GetDatabase().SetGamePlayerPlace(server->GetDBId(), tmpPlayer->GetDBId(), 1);
server->GetDatabase().EndGame(server->GetDBId());
}
// View a dialog for a new game - delayed.