demoplayer disconnect when render finished

This commit is contained in:
sirius 2019-09-27 17:16:48 +08:00
parent 628f1eb777
commit 1c150106f8
2 changed files with 5 additions and 0 deletions

View file

@ -778,6 +778,7 @@ void CClient::DisconnectWithReason(const char *pReason)
void CClient::Disconnect() void CClient::Disconnect()
{ {
m_ButtonRender = false;
if(m_DummyConnected) if(m_DummyConnected)
DummyDisconnect(0); DummyDisconnect(0);
if(m_State != IClient::STATE_OFFLINE) if(m_State != IClient::STATE_OFFLINE)
@ -2515,6 +2516,8 @@ void CClient::Update()
IVideo::Current()->nextVideoFrame(); IVideo::Current()->nextVideoFrame();
} }
} }
else if(m_ButtonRender)
Disconnect();
#endif #endif
@ -3573,6 +3576,7 @@ const char *CClient::DemoPlayer_Render(const char *pFilename, int StorageType, c
// enter demo playback state // enter demo playback state
SetState(IClient::STATE_DEMOPLAYBACK); SetState(IClient::STATE_DEMOPLAYBACK);
m_ButtonRender = true;
this->CClient::StartVideo(NULL, this, pVideoName); this->CClient::StartVideo(NULL, this, pVideoName);
m_DemoPlayer.Play(); m_DemoPlayer.Play();

View file

@ -122,6 +122,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
int m_UseTempRconCommands; int m_UseTempRconCommands;
char m_Password[32]; char m_Password[32];
bool m_SendPassword; bool m_SendPassword;
bool m_ButtonRender=false;
// version-checking // version-checking
char m_aVersionStr[10]; char m_aVersionStr[10];