mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #385 from H-M-H/faking_bugfix
FIRST trim the name and THEN compare it to others !
This commit is contained in:
commit
8d63d0d536
|
@ -333,7 +333,12 @@ int CServer::TrySetClientName(int ClientID, const char *pName)
|
|||
if(!aTrimmedName[0])
|
||||
return -1;
|
||||
|
||||
// make sure that two clients doesn't have the same name
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' -> '%s'", pName, aTrimmedName);
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
|
||||
pName = aTrimmedName;
|
||||
|
||||
// make sure that two clients don't have the same name
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
if(i != ClientID && m_aClients[i].m_State >= CClient::STATE_READY)
|
||||
{
|
||||
|
@ -341,11 +346,6 @@ int CServer::TrySetClientName(int ClientID, const char *pName)
|
|||
return -1;
|
||||
}
|
||||
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "'%s' -> '%s'", pName, aTrimmedName);
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
|
||||
pName = aTrimmedName;
|
||||
|
||||
// set the client name
|
||||
str_copy(m_aClients[ClientID].m_aName, pName, MAX_NAME_LENGTH);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue