1
0

fixed naming of strings and changed from i to I

This commit is contained in:
Vincent 2014-11-29 11:22:03 -08:00
parent 61e761fdc2
commit a7bf2725c8
5 changed files with 18 additions and 13 deletions

View File

@ -1798,16 +1798,16 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
return false; return false;
} }
} }
if (!(cRoot::Get()->GetServer()->isAllowMultiLogin())) if (!(cRoot::Get()->GetServer()->IsAllowMultiLogin()))
{ {
std::list<std::string> usernamesServer = cRoot::Get()->GetServer()->GetUsernames(); std::list<AString> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
std::list<std::string> usernamesWorld = cRoot::Get()->GetDefaultWorld()-> GetUsernames(); std::list<AString> usernamesWorld = cRoot::Get()->GetDefaultWorld()-> GetUsernames();
usernamesServer.sort(); usernamesServer.sort();
usernamesWorld.sort(); usernamesWorld.sort();
usernamesServer.merge(usernamesWorld); usernamesServer.merge(usernamesWorld);
for (std::list<std::string>::iterator itr = usernamesServer.begin(); itr != usernamesServer.end(); ++itr) for (std::list<AString>::iterator itr = usernamesServer.begin(); itr != usernamesServer.end(); ++itr)
{ {
if ((*itr).compare(a_Username) == 0) if ((*itr).compare(a_Username) == 0)
{ {

View File

@ -304,13 +304,13 @@ int cServer::GetNumPlayers(void) const
std::list<std::string> cServer::GetUsernames() std::list<AString> cServer::GetUsernames()
{ {
std::list<std::string> usernames; std::list<AString> usernames;
cCSLock Lock(m_CSClients); cCSLock Lock(m_CSClients);
for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr)
{ {
std::string username = (*itr)->GetUsername(); AString username = (*itr)->GetUsername();
usernames.insert(usernames.begin(),username); usernames.insert(usernames.begin(),username);
} }
return usernames; return usernames;

View File

@ -68,10 +68,10 @@ public: // tolua_export
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. // Get the users waiting to be put into the World.
std::list<std::string> GetUsernames(void); std::list<AString> GetUsernames(void);
// 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; }
// Hardcore mode or not: // Hardcore mode or not:
bool IsHardcore(void) const { return m_bIsHardcore; } bool IsHardcore(void) const { return m_bIsHardcore; }

View File

@ -3667,14 +3667,18 @@ void cWorld::cChunkGeneratorCallbacks::CallHookChunkGenerated (cChunkDesc & a_Ch
std::list<std::string> cWorld::GetUsernames() std::list<AString> cWorld::GetUsernames()
{ {
std::list<std::string> usernames; std::list<AString> usernames;
cCSLock Lock(m_CSPlayers); cCSLock Lock(m_CSPlayers);
for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{ {
std::string username = (*itr)->GetName(); AString username = (*itr)->GetName();
usernames.insert(usernames.begin(),username); usernames.insert(usernames.begin(),username);
} }
return usernames; return usernames;
} }

View File

@ -809,7 +809,8 @@ public:
void SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicked = true); // tolua_export void SetChunkAlwaysTicked(int a_ChunkX, int a_ChunkZ, bool a_AlwaysTicked = true); // tolua_export
/** Get the usernames from the World. */ /** Get the usernames from the World. */
std::list<std::string> GetUsernames(void); std::list<AString> GetUsernames(void);
private: private:
friend class cRoot; friend class cRoot;