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: public:
cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {} cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {}
} PlayerCallback((m_Server->GetShutdownMessage())); };
cRoot::Get()->ForEachPlayer(PlayerCallback); if (m_Server->GetNumPlayers())
// What's a better way to do this? {
std::this_thread::sleep_for(std::chrono::seconds(1)); cPlayerCallback PlayerCallback((m_Server->GetShutdownMessage()));
cRoot::Get()->ForEachPlayer(PlayerCallback);
std::this_thread::sleep_for(std::chrono::seconds(1));
}
m_TerminateEventRaised = true; m_TerminateEventRaised = true;
m_StopEvent.Set(); m_StopEvent.Set();
m_InputThreadRunFlag.clear(); m_InputThreadRunFlag.clear();