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
+4
View File
@@ -157,11 +157,15 @@ AbstractServerGameStateReceiving::Process(ServerGameThread &server)
if (tmpSession.sessionData.get() && tmpSession.playerData.get())
{
// Send player info to client.
// TODO this is a copy and paste
boost::shared_ptr<NetPacket> info(new NetPacketPlayerInfo);
NetPacketPlayerInfo::Data infoData;
infoData.playerId = tmpSession.playerData->GetUniqueId();
infoData.playerInfo.ptype = tmpSession.playerData->GetType();
infoData.playerInfo.playerName = tmpSession.playerData->GetName();
infoData.playerInfo.hasAvatar = !tmpSession.playerData->GetAvatarFile().empty();
if (infoData.playerInfo.hasAvatar)
infoData.playerInfo.avatar.FromString(tmpSession.playerData->GetAvatarFile());
static_cast<NetPacketPlayerInfo *>(info.get())->SetData(infoData);
server.GetSender().Send(session.sessionData->GetSocket(), info);
}