Fixing ticket #86: Change player id in ranking map on rejoin.

This commit is contained in:
lotodore
2011-12-27 20:44:16 +00:00
parent 6c4a8652fe
commit 28417227ac
3 changed files with 14 additions and 0 deletions
+11
View File
@@ -358,6 +358,17 @@ ServerGame::SetPlayerPlace(unsigned playerId, int place)
} }
} }
void
ServerGame::ReplaceRankingPlayer(unsigned oldPlayerId, unsigned newPlayerId)
{
RankingMap::iterator pos = m_rankingMap.find(oldPlayerId);
if (pos != m_rankingMap.end()) {
RankingData tmpData((*pos).second);
m_rankingMap[newPlayerId] = tmpData;
m_rankingMap.erase(pos);
}
}
void void
ServerGame::StoreAndResetRanking() ServerGame::StoreAndResetRanking()
{ {
+2
View File
@@ -1360,6 +1360,8 @@ ServerGameStateHand::PerformRejoin(boost::shared_ptr<ServerGame> server, boost::
// Update the dealer, if necessary. // Update the dealer, if necessary.
curGame.replaceDealer(rejoinPlayer->getMyUniqueID(), session->GetPlayerData()->GetUniqueId()); curGame.replaceDealer(rejoinPlayer->getMyUniqueID(), session->GetPlayerData()->GetUniqueId());
// Update the ranking map.
server->ReplaceRankingPlayer(rejoinPlayer->getMyUniqueID(), session->GetPlayerData()->GetUniqueId());
// Change the Id in the poker engine. // Change the Id in the poker engine.
rejoinPlayer->setMyUniqueID(session->GetPlayerData()->GetUniqueId()); rejoinPlayer->setMyUniqueID(session->GetPlayerData()->GetUniqueId());
rejoinPlayer->setMyGuid(session->GetPlayerData()->GetGuid()); rejoinPlayer->setMyGuid(session->GetPlayerData()->GetGuid());
+1
View File
@@ -118,6 +118,7 @@ protected:
void InitRankingMap(const PlayerDataList &playerDataList); void InitRankingMap(const PlayerDataList &playerDataList);
void UpdateRankingMap(); void UpdateRankingMap();
void SetPlayerPlace(unsigned playerId, int place); void SetPlayerPlace(unsigned playerId, int place);
void ReplaceRankingPlayer(unsigned oldPlayerId, unsigned newPlayerId);
void StoreAndResetRanking(); void StoreAndResetRanking();
void RemoveAutoLeavePlayers(); void RemoveAutoLeavePlayers();
void InternalEndGame(); void InternalEndGame();