From 8500365f407562737e91530e2e8cf56706d8a294 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Thu, 17 Mar 2016 14:43:15 -0400 Subject: [PATCH] try to restart game process if it was terminated --- src/network/stand_gui.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/network/stand_gui.cpp b/src/network/stand_gui.cpp index b57b096..32c306a 100644 --- a/src/network/stand_gui.cpp +++ b/src/network/stand_gui.cpp @@ -1360,6 +1360,21 @@ void Standalone::wsDoFrame() // if connection is lost attempt reconnect every 2 seconds if ( !wsi_standalone && !(++m_rate_limit % 60) ) { + // restart game process if it terminated + if ( !wxProcess::Exists(fspid) ) { + wxCmdLineArgsArray empty; + + try { + startFreeSpace(0, empty); + } catch (const char *err) { + wxMessageBox(err, "Error!", wxOK|wxICON_ERROR|wxCENTRE|wxSTAY_ON_TOP); + + Shutdown(); + } + + wxMilliSleep(500); + } + wsi_standalone = lws_client_connect_via_info(&ccinfo); m_rate_limit = 0; } -- 2.39.2