Fixed compile errors
This commit is contained in:
parent
656964dc38
commit
6de07d4a39
@ -1788,19 +1788,14 @@ void cClientHandle::HandleKeepAlive(int a_KeepAliveID)
|
||||
|
||||
|
||||
|
||||
bool cClientHandle::CheckMultiLogin(void)
|
||||
bool cClientHandle::CheckMultiLogin(const AString & a_Username)
|
||||
{
|
||||
if (!(cRoot::Get()->GetServer()->IsAllowMultiLogin()))
|
||||
{
|
||||
std::list<AString> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
|
||||
|
||||
for (auto item : usernamesServer)
|
||||
if (cRoot::Get()->GetServer()->IsPlayerInQueue(a_Username))
|
||||
{
|
||||
if ((item).compare(a_Username) == 0)
|
||||
{
|
||||
Kick("A player of the username is already logged in");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class cCallback :
|
||||
@ -1837,7 +1832,7 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
|
||||
}
|
||||
}
|
||||
|
||||
return CheckMultiLogin();
|
||||
return CheckMultiLogin(a_Username);
|
||||
}
|
||||
|
||||
|
||||
|
@ -281,7 +281,7 @@ public:
|
||||
void HandleEntitySprinting (int a_EntityID, bool a_IsSprinting);
|
||||
|
||||
/** Kicks the current player if the same username is already logged in. */
|
||||
bool CheckMultiLogin(void);
|
||||
bool CheckMultiLogin(const AString & a_Username);
|
||||
/** Called when the protocol handshake has been received (for protocol versions that support it;
|
||||
otherwise the first instant when a username is received).
|
||||
Returns true if the player is to be let in, false if they were disconnected
|
||||
|
@ -649,7 +649,7 @@ bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback
|
||||
|
||||
|
||||
|
||||
bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback)
|
||||
bool cRoot::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
/** Finds the player over his uuid and calls the callback */
|
||||
bool DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
|
||||
|
||||
bool FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback);
|
||||
bool DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
@ -304,16 +304,17 @@ int cServer::GetNumPlayers(void) const
|
||||
|
||||
|
||||
|
||||
std::list<AString> cServer::GetUsernames()
|
||||
bool cServer::IsPlayerInQueue(AString a_Username)
|
||||
{
|
||||
std::list<AString> usernames;
|
||||
cCSLock Lock(m_CSClients);
|
||||
for (auto client : m_Clients)
|
||||
{
|
||||
AString username = (client)->GetUsername();
|
||||
usernames.insert(usernames.begin(),username);
|
||||
if ((client->GetUsername()).compare(a_Username) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return usernames;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,8 +67,8 @@ public: // tolua_export
|
||||
int GetNumPlayers(void) const;
|
||||
void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; }
|
||||
|
||||
// Get the users waiting to be put into the World.
|
||||
std::list<AString> GetUsernames(void);
|
||||
// Check if the player is queued to be transferred to a World.
|
||||
bool IsPlayerInQueue(AString a_Username);
|
||||
|
||||
// Can login more than once with same username.
|
||||
bool IsAllowMultiLogin(void) { return m_bAllowMultiLogin; }
|
||||
|
Loading…
Reference in New Issue
Block a user