mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Merge #1152
1152: send password to first connected server r=heinrich5991 a=ZombieToad https://github.com/ddnet/ddnet/pull/1149#issuecomment-397538132 fixes issues with connecting to servers with reserved slots Co-authored-by: ZombieToad <25847476+zombietoad@users.noreply.github.com>
This commit is contained in:
commit
af1f9d198a
|
@ -690,7 +690,12 @@ void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
net_host_lookup("localhost", &m_ServerAddress, m_NetClient[0].NetType());
|
net_host_lookup("localhost", &m_ServerAddress, m_NetClient[0].NetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pPassword)
|
if(m_SendPassword)
|
||||||
|
{
|
||||||
|
str_copy(m_Password, g_Config.m_Password, sizeof(m_Password));
|
||||||
|
m_SendPassword = false;
|
||||||
|
}
|
||||||
|
else if(!pPassword)
|
||||||
m_Password[0] = 0;
|
m_Password[0] = 0;
|
||||||
else
|
else
|
||||||
str_copy(m_Password, pPassword, sizeof(m_Password));
|
str_copy(m_Password, pPassword, sizeof(m_Password));
|
||||||
|
@ -3378,6 +3383,14 @@ void CClient::ConchainTimeoutSeed(IConsole::IResult *pResult, void *pUserData, I
|
||||||
pSelf->m_GenerateTimeoutSeed = false;
|
pSelf->m_GenerateTimeoutSeed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClient::ConchainPassword(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||||
|
{
|
||||||
|
CClient *pSelf = (CClient *)pUserData;
|
||||||
|
pfnCallback(pResult, pCallbackUserData);
|
||||||
|
if(pResult->NumArguments() && pSelf->m_LocalStartTime) //won't set m_SendPassword before game has started
|
||||||
|
pSelf->m_SendPassword = true;
|
||||||
|
}
|
||||||
|
|
||||||
void CClient::RegisterCommands()
|
void CClient::RegisterCommands()
|
||||||
{
|
{
|
||||||
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
||||||
|
@ -3416,9 +3429,11 @@ void CClient::RegisterCommands()
|
||||||
m_pConsole->Register("demo_play", "", CFGFLAG_CLIENT, Con_DemoPlay, this, "Play demo");
|
m_pConsole->Register("demo_play", "", CFGFLAG_CLIENT, Con_DemoPlay, this, "Play demo");
|
||||||
m_pConsole->Register("demo_speed", "i[speed]", CFGFLAG_CLIENT, Con_DemoSpeed, this, "Set demo speed");
|
m_pConsole->Register("demo_speed", "i[speed]", CFGFLAG_CLIENT, Con_DemoSpeed, this, "Set demo speed");
|
||||||
|
|
||||||
// used for server browser update
|
|
||||||
m_pConsole->Chain("cl_timeout_seed", ConchainTimeoutSeed, this);
|
m_pConsole->Chain("cl_timeout_seed", ConchainTimeoutSeed, this);
|
||||||
|
|
||||||
|
m_pConsole->Chain("password", ConchainPassword, this);
|
||||||
|
|
||||||
|
// used for server browser update
|
||||||
m_pConsole->Chain("br_filter_string", ConchainServerBrowserUpdate, this);
|
m_pConsole->Chain("br_filter_string", ConchainServerBrowserUpdate, this);
|
||||||
m_pConsole->Chain("br_filter_gametype", ConchainServerBrowserUpdate, this);
|
m_pConsole->Chain("br_filter_gametype", ConchainServerBrowserUpdate, this);
|
||||||
m_pConsole->Chain("br_filter_serveraddress", ConchainServerBrowserUpdate, this);
|
m_pConsole->Chain("br_filter_serveraddress", ConchainServerBrowserUpdate, this);
|
||||||
|
|
|
@ -112,6 +112,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
||||||
char m_RconPassword[32];
|
char m_RconPassword[32];
|
||||||
int m_UseTempRconCommands;
|
int m_UseTempRconCommands;
|
||||||
char m_Password[32];
|
char m_Password[32];
|
||||||
|
bool m_SendPassword;
|
||||||
|
|
||||||
// version-checking
|
// version-checking
|
||||||
char m_aVersionStr[10];
|
char m_aVersionStr[10];
|
||||||
|
@ -348,6 +349,7 @@ public:
|
||||||
static void ConchainWindowScreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
static void ConchainWindowScreen(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
static void ConchainWindowVSync(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
static void ConchainWindowVSync(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
static void ConchainTimeoutSeed(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
static void ConchainTimeoutSeed(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
static void ConchainPassword(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
|
||||||
static void Con_DemoSlice(IConsole::IResult *pResult, void *pUserData);
|
static void Con_DemoSlice(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void Con_DemoSliceBegin(IConsole::IResult *pResult, void *pUserData);
|
static void Con_DemoSliceBegin(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
|
Loading…
Reference in a new issue