Make client launchable from browser

By needs from https://github.com/teeworlds/teeworlds/pull/1478/files
This commit is contained in:
def 2018-12-13 19:57:32 +01:00
parent ff36974bed
commit c4d437bc0f
2 changed files with 12 additions and 1 deletions

View file

@ -3542,6 +3542,11 @@ static CClient *CreateClient()
return new(pClient) CClient;
}
void CClient::HandleConnectLink(const char *pArg)
{
str_copy(m_aCmdConnect, pArg + sizeof(CONNECTLINK) - 1, sizeof(m_aCmdConnect));
}
/*
Server Time
Client Mirror Time
@ -3688,7 +3693,9 @@ int main(int argc, const char **argv) // ignore_convention
g_Config.m_ClConfigVersion = 1;
// parse the command line arguments
if(argc > 1) // ignore_convention
if(argc == 2 && str_startswith(argv[1], CONNECTLINK))
pClient->HandleConnectLink(argv[1]);
else if(argc > 1) // ignore_convention
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
pClient->Engine()->InitLogfile();

View file

@ -8,6 +8,8 @@
#include <base/hash.h>
#include <engine/shared/http.h>
#define CONNECTLINK "ddnet:"
class CGraph
{
public:
@ -382,6 +384,8 @@ public:
void ServerBrowserUpdate();
void HandleConnectLink(const char *pLink);
// gfx
void SwitchWindowScreen(int Index);
void ToggleFullscreen();