1
0

Player check

Checks if there are any players connected to the server before running
PlayerCallback and waiting 1 second.
This commit is contained in:
sweetgiorni 2017-01-03 12:26:58 -08:00
parent 78b6d54bf8
commit 0718d82e1a

View File

@ -343,11 +343,14 @@ void cRoot::StopServer()
}
public:
cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {}
} PlayerCallback((m_Server->GetShutdownMessage()));
};
if (m_Server->GetNumPlayers())
{
cPlayerCallback PlayerCallback((m_Server->GetShutdownMessage()));
cRoot::Get()->ForEachPlayer(PlayerCallback);
// What's a better way to do this?
std::this_thread::sleep_for(std::chrono::seconds(1));
}
m_TerminateEventRaised = true;
m_StopEvent.Set();
m_InputThreadRunFlag.clear();