PlayerIdList StoreLastGames

This commit is contained in:
Kai Philipp
2019-09-10 21:15:38 +02:00
parent 1eb486660e
commit 9d31fc3b5e
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -452,8 +452,11 @@ void
ServerGame::StoreLastGames() ServerGame::StoreLastGames()
{ {
// Store players lastgames in database. // Store players lastgames in database.
RankingMap::const_iterator i = m_rankingMap.begin();
RankingMap::const_iterator end = m_rankingMap.end(); PlayerIdList plist = GetPlayerIdList();
RankingMap::const_iterator i = plist.info.players.begin();
RankingMap::const_iterator end = plist.info.players.end();
while (i != end) { while (i != end) {
boost::shared_ptr<SessionData> tmpSession = GetSessionManager().GetSessionByUniquePlayerId((*i).second.dbid); boost::shared_ptr<SessionData> tmpSession = GetSessionManager().GetSessionByUniquePlayerId((*i).second.dbid);
@@ -462,7 +465,7 @@ ServerGame::StoreLastGames()
if(tmpSession){ if(tmpSession){
std::vector<long> lastGames = tmpSession->GetPlayerData()->GetPlayerLastGames(); std::vector<long> lastGames = tmpSession->GetPlayerData()->GetPlayerLastGames();
if(lastGames.size() > 0) //if(lastGames.size() > 0)
//GetLobbyThread().GetDatabase().SetGamePlayerPlace(GetId(), (*i).second.dbid, lastGames); //GetLobbyThread().GetDatabase().SetGamePlayerPlace(GetId(), (*i).second.dbid, lastGames);
LOG_VERBOSE("last timeStamp" << *lastGames.end() << "."); LOG_VERBOSE("last timeStamp" << *lastGames.end() << ".");
} }
+1 -1
View File
@@ -1440,7 +1440,7 @@ ServerLobbyThread::HandleNetPacketJoinGame(boost::shared_ptr<SessionData> sessio
} else { } else {
// @FIXME: debug only - final position is gamestart // @FIXME: debug only - final position is gamestart
session->GetPlayerData()->AddPlayerLastGame((long)time(NULL)); session->GetPlayerData()->AddPlayerLastGame((long)time(NULL));
LOG_ERROR("TimeStamp stored: " << *session->GetPlayerData()->GetPlayerLastGames().end()); LOG_ERROR("TimeStamp stored: " << *session->GetPlayerData()->GetPlayerLastGames().back());
MoveSessionToGame(game, session, joinGame.autoleave(), false); MoveSessionToGame(game, session, joinGame.autoleave(), false);
} }
} }