diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index da0ac7c9..6632302a 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -1725,6 +1725,11 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr 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); + } } } } diff --git a/src/net/common/clientthread.cpp b/src/net/common/clientthread.cpp index b021651d..083cc062 100644 --- a/src/net/common/clientthread.cpp +++ b/src/net/common/clientthread.cpp @@ -703,8 +703,8 @@ ClientThread::SetPlayerInfo(unsigned id, const PlayerInfo &info) } // Update player data for current game. - boost::shared_ptr playerData = GetPlayerDataByUniqueId(id); - if (playerData.get()) { + boost::shared_ptr 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 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);