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