Show avatars in network games. User defined avatars are not transfered yet, but this is already prepared for integration.

This commit is contained in:
lotodore
2007-09-09 00:00:19 +00:00
parent b71ae4ac17
commit e8eddd3b1b
10 changed files with 129 additions and 22 deletions
+5
View File
@@ -296,6 +296,8 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const NetPacketIn
new PlayerData(GetNextUniquePlayerId(), 0, PLAYER_TYPE_HUMAN, PLAYER_RIGHTS_NORMAL));
tmpPlayerData->SetName(initData.playerName);
tmpPlayerData->SetNetSessionData(session.sessionData);
if (initData.showAvatar)
tmpPlayerData->SetAvatarFile(initData.avatar.ToString());
// Send ACK to client.
boost::shared_ptr<NetPacket> initAck(new NetPacketInitAck);
@@ -344,6 +346,9 @@ ServerLobbyThread::HandleNetPacketRetrievePlayerInfo(SessionWrapper session, con
infoData.playerId = tmpPlayer->GetUniqueId();
infoData.playerInfo.ptype = tmpPlayer->GetType();
infoData.playerInfo.playerName = tmpPlayer->GetName();
infoData.playerInfo.hasAvatar = !tmpPlayer->GetAvatarFile().empty();
if (infoData.playerInfo.hasAvatar)
infoData.playerInfo.avatar.FromString(tmpPlayer->GetAvatarFile());
static_cast<NetPacketPlayerInfo *>(info.get())->SetData(infoData);
GetSender().Send(session.sessionData->GetSocket(), info);
}