Kill server on quit

As suggested by Ryozuki
This commit is contained in:
def 2020-09-18 00:30:29 +02:00
parent 3983bfeeef
commit 46b21020be
3 changed files with 12 additions and 2 deletions

View file

@ -354,6 +354,7 @@ public:
void RenderUpdating(const char *pCaption, int current=0, int total=0);
bool IsActive() const { return m_MenuActive; }
void KillServer();
virtual void OnInit();

View file

@ -107,8 +107,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
{
if(m_ServerProcess.Process)
{
kill_process(m_ServerProcess.Process);
m_ServerProcess.Process = 0;
KillServer();
}
else
{
@ -252,3 +251,12 @@ void CMenus::RenderStartMenu(CUIRect MainView)
m_ShowStart = false;
}
}
void CMenus::KillServer()
{
if(m_ServerProcess.Process)
{
kill_process(m_ServerProcess.Process);
m_ServerProcess.Process = 0;
}
}

View file

@ -883,6 +883,7 @@ void CGameClient::OnStateChange(int NewState, int OldState)
void CGameClient::OnShutdown()
{
m_pMenus->KillServer();
m_pRaceDemo->OnReset();
m_pGhost->OnReset();
}