Fixing compiler error.
This commit is contained in:
@@ -878,8 +878,8 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage
|
|||||||
const AuthenticatedLogin_t *authLogin = &initMessage.login.choice.authenticatedLogin;
|
const AuthenticatedLogin_t *authLogin = &initMessage.login.choice.authenticatedLogin;
|
||||||
playerName = string((const char *)authLogin->playerName.buf, authLogin->playerName.size);
|
playerName = string((const char *)authLogin->playerName.buf, authLogin->playerName.size);
|
||||||
password = string((const char *)authLogin->password.buf, authLogin->password.size);
|
password = string((const char *)authLogin->password.buf, authLogin->password.size);
|
||||||
if (anonLogin->avatar)
|
if (authLogin->avatar)
|
||||||
memcpy(avatarMD5.data, anonLogin->avatar->buf, MD5_DATA_SIZE);
|
memcpy(avatarMD5.data, authLogin->avatar->buf, MD5_DATA_SIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SessionError(session, ERR_NET_INVALID_PASSWORD); // TODO not yet supported
|
SessionError(session, ERR_NET_INVALID_PASSWORD); // TODO not yet supported
|
||||||
@@ -934,27 +934,10 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage
|
|||||||
m_sessionManager.SetSessionPlayerData(session.sessionData->GetId(), tmpPlayerData);
|
m_sessionManager.SetSessionPlayerData(session.sessionData->GetId(), tmpPlayerData);
|
||||||
session.playerData = tmpPlayerData;
|
session.playerData = tmpPlayerData;
|
||||||
|
|
||||||
string avatarFileName;
|
if (guestUser)
|
||||||
if (!avatarMD5.IsZero()
|
InitAfterLogin(session);
|
||||||
&& !GetAvatarManager().GetAvatarFileName(avatarMD5, avatarFileName))
|
|
||||||
{
|
|
||||||
bool avatarRecentlyRequested = false;
|
|
||||||
{
|
|
||||||
boost::mutex::scoped_lock lock(m_timerAvatarClientAddressMapMutex);
|
|
||||||
if (m_timerAvatarClientAddressMap.find(session.sessionData->GetClientAddr()) != m_timerAvatarClientAddressMap.end())
|
|
||||||
avatarRecentlyRequested = true;
|
|
||||||
}
|
|
||||||
if (avatarRecentlyRequested)
|
|
||||||
SessionError(session, ERR_NET_AVATAR_UPLOAD_BLOCKED);
|
|
||||||
else
|
else
|
||||||
RequestPlayerAvatar(session);
|
AuthenticatePlayer(session, password);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!avatarFileName.empty())
|
|
||||||
session.playerData->SetAvatarFile(avatarFileName);
|
|
||||||
EstablishSession(session);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1206,6 +1189,34 @@ ServerLobbyThread::HandleNetPacketChatRequest(SessionWrapper session, const Chat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerLobbyThread::InitAfterLogin(SessionWrapper session)
|
||||||
|
{
|
||||||
|
assert(session.playerData);
|
||||||
|
const MD5Buf &avatarMD5 = session.playerData->GetAvatarMD5();
|
||||||
|
string avatarFileName;
|
||||||
|
if (!avatarMD5.IsZero()
|
||||||
|
&& !GetAvatarManager().GetAvatarFileName(avatarMD5, avatarFileName))
|
||||||
|
{
|
||||||
|
bool avatarRecentlyRequested = false;
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_timerAvatarClientAddressMapMutex);
|
||||||
|
if (m_timerAvatarClientAddressMap.find(session.sessionData->GetClientAddr()) != m_timerAvatarClientAddressMap.end())
|
||||||
|
avatarRecentlyRequested = true;
|
||||||
|
}
|
||||||
|
if (avatarRecentlyRequested)
|
||||||
|
SessionError(session, ERR_NET_AVATAR_UPLOAD_BLOCKED);
|
||||||
|
else
|
||||||
|
RequestPlayerAvatar(session);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!avatarFileName.empty())
|
||||||
|
session.playerData->SetAvatarFile(avatarFileName);
|
||||||
|
EstablishSession(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerLobbyThread::EstablishSession(SessionWrapper session)
|
ServerLobbyThread::EstablishSession(SessionWrapper session)
|
||||||
{
|
{
|
||||||
@@ -1241,6 +1252,12 @@ ServerLobbyThread::EstablishSession(SessionWrapper session)
|
|||||||
UpdateStatisticsNumberOfPlayers();
|
UpdateStatisticsNumberOfPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerLobbyThread::AuthenticatePlayer(SessionWrapper session, const std::string &password)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ServerLobbyThread::RequestPlayerAvatar(SessionWrapper session)
|
ServerLobbyThread::RequestPlayerAvatar(SessionWrapper session)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ protected:
|
|||||||
void HandleNetPacketCreateGame(SessionWrapper session, const std::string &password, const JoinNewGame_t &newGame);
|
void HandleNetPacketCreateGame(SessionWrapper session, const std::string &password, const JoinNewGame_t &newGame);
|
||||||
void HandleNetPacketJoinGame(SessionWrapper session, const std::string &password, const JoinExistingGame_t &joinGame);
|
void HandleNetPacketJoinGame(SessionWrapper session, const std::string &password, const JoinExistingGame_t &joinGame);
|
||||||
void HandleNetPacketChatRequest(SessionWrapper session, const ChatRequestMessage_t &chatRequest);
|
void HandleNetPacketChatRequest(SessionWrapper session, const ChatRequestMessage_t &chatRequest);
|
||||||
|
void InitAfterLogin(SessionWrapper session);
|
||||||
void EstablishSession(SessionWrapper session);
|
void EstablishSession(SessionWrapper session);
|
||||||
|
void AuthenticatePlayer(SessionWrapper session, const std::string &password);
|
||||||
void RequestPlayerAvatar(SessionWrapper session);
|
void RequestPlayerAvatar(SessionWrapper session);
|
||||||
void TimerRemoveGame(const boost::system::error_code &ec);
|
void TimerRemoveGame(const boost::system::error_code &ec);
|
||||||
void TimerRemovePlayer(const boost::system::error_code &ec);
|
void TimerRemovePlayer(const boost::system::error_code &ec);
|
||||||
|
|||||||
Reference in New Issue
Block a user