Try to update the player name after rejoin, if another player was not active during rejoin.

This commit is contained in:
lotodore
2011-12-29 22:09:11 +00:00
parent 64156cfa69
commit d12ee37bac
2 changed files with 13 additions and 2 deletions
+5
View File
@@ -1725,6 +1725,11 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
tmpPlayer->setMyStayOnTableStatus(true);
// Also update the dealer, if necessary.
curGame->replaceDealer(idChanged->oldPlayerId, idChanged->newPlayerId);
// Update the player name, if necessary.
PlayerInfo info;
if (client->GetCachedPlayerInfo(idChanged->newPlayerId, info)) {
tmpPlayer->setMyName(info.playerName);
}
}
}
}
+8 -2
View File
@@ -703,8 +703,8 @@ ClientThread::SetPlayerInfo(unsigned id, const PlayerInfo &info)
}
// Update player data for current game.
boost::shared_ptr<PlayerData> playerData = GetPlayerDataByUniqueId(id);
if (playerData.get()) {
boost::shared_ptr<PlayerData> playerData(GetPlayerDataByUniqueId(id));
if (playerData) {
playerData->SetName(info.playerName);
playerData->SetType(info.ptype);
if (info.hasAvatar) {
@@ -714,6 +714,12 @@ ClientThread::SetPlayerInfo(unsigned id, const PlayerInfo &info)
}
}
}
if (GetGame()) {
boost::shared_ptr<PlayerInterface> clientPlayer(GetGame()->getPlayerByUniqueId(id));
if (clientPlayer)
clientPlayer->setMyName(info.playerName);
// Skip avatar here, the game is already running.
}
if (find(m_avatarShouldRequestList.begin(), m_avatarShouldRequestList.end(), id) != m_avatarShouldRequestList.end()) {
m_avatarShouldRequestList.remove(id);