Trying to log winner in database.

This commit is contained in:
lotodore
2010-07-19 19:29:49 +00:00
parent 4ed1122931
commit 966fb50662
+6
View File
@@ -25,6 +25,7 @@
#include <net/netpacket.h>
#include <net/socket_msg.h>
#include <net/serverexception.h>
#include <db/serverdbinterface.h>
#include <core/loghelper.h>
#include <gamedata.h>
#include <game.h>
@@ -1010,6 +1011,11 @@ ServerGameStateHand::TimerNextGame(const boost::system::error_code &ec, boost::s
netEndGame->winnerPlayerId = winnerPlayer->getMyUniqueID();
server->SendToAllPlayers(endGame, SessionData::Game);
// Set winner in database.
boost::shared_ptr<PlayerData> tmpPlayer = server->GetPlayerDataByUniqueId(winnerPlayer->getMyUniqueID());
if (tmpPlayer)
server->GetLobbyThread().GetDatabase().SetGamePlayerPlace(server->GetDBId(), tmpPlayer->GetDBId(), 1);
// Wait for the start of a new game.
server->ResetComputerPlayerList();
server->ResetGame();