mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Enable dragging demo file into client to play it directly
This commit is contained in:
parent
a4e2130342
commit
cca80da554
|
@ -2859,6 +2859,13 @@ void CClient::Run()
|
|||
m_aCmdConnect[0] = 0;
|
||||
}
|
||||
|
||||
// handle pending demo play
|
||||
if(m_aCmdPlayDemo[0])
|
||||
{
|
||||
DemoPlayer_Play(m_aCmdPlayDemo, IStorage::TYPE_ABSOLUTE);
|
||||
m_aCmdPlayDemo[0] = 0;
|
||||
}
|
||||
|
||||
// progress on dummy connect if security token handshake skipped/passed
|
||||
if(m_DummySendConnInfo && !m_NetClient[1].SecurityTokenUnknown())
|
||||
{
|
||||
|
@ -3622,9 +3629,14 @@ static CClient *CreateClient()
|
|||
return new(pClient) CClient;
|
||||
}
|
||||
|
||||
void CClient::HandleConnectLink(const char *pArg)
|
||||
void CClient::HandleConnectLink(const char *pLink)
|
||||
{
|
||||
str_copy(m_aCmdConnect, pArg + sizeof(CONNECTLINK) - 1, sizeof(m_aCmdConnect));
|
||||
str_copy(m_aCmdConnect, pLink + sizeof(CONNECTLINK) - 1, sizeof(m_aCmdConnect));
|
||||
}
|
||||
|
||||
void CClient::HandleDemoLink(const char *pLink)
|
||||
{
|
||||
str_copy(m_aCmdPlayDemo, pLink, sizeof(m_aCmdPlayDemo));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3775,7 +3787,9 @@ int main(int argc, const char **argv) // ignore_convention
|
|||
// parse the command line arguments
|
||||
if(argc == 2 && str_startswith(argv[1], CONNECTLINK))
|
||||
pClient->HandleConnectLink(argv[1]);
|
||||
else if(argc > 1) // ignore_convention
|
||||
if(argc == 2 && str_endswith(argv[1], ".demo"))
|
||||
pClient->HandleDemoLink(argv[1]);
|
||||
if(argc > 1) // ignore_convention
|
||||
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
|
||||
|
||||
pClient->Engine()->InitLogfile();
|
||||
|
|
|
@ -132,6 +132,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
|
||||
//
|
||||
char m_aCmdConnect[256];
|
||||
char m_aCmdPlayDemo[MAX_PATH_LENGTH];
|
||||
|
||||
// map download
|
||||
std::shared_ptr<CGetFile> m_pMapdownloadTask;
|
||||
|
@ -385,6 +386,7 @@ public:
|
|||
void ServerBrowserUpdate();
|
||||
|
||||
void HandleConnectLink(const char *pLink);
|
||||
void HandleDemoLink(const char *pLink);
|
||||
|
||||
// gfx
|
||||
void SwitchWindowScreen(int Index);
|
||||
|
|
Loading…
Reference in a new issue