1
0

Disconnect sent flag added

Truthiness no longer assumed
This commit is contained in:
sweetgiorni 2017-01-03 12:39:39 -08:00
parent ff1c0605db
commit 6522385897

View File

@ -339,16 +339,17 @@ void cRoot::StopServer()
virtual bool Item(cPlayer * a_Player) virtual bool Item(cPlayer * a_Player)
{ {
a_Player->GetClientHandlePtr()->Kick(m_ShutdownMessage); a_Player->GetClientHandlePtr()->Kick(m_ShutdownMessage);
m_HasSentDisconnect = true;
return false; return false;
} }
public: public:
cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {} bool m_HasSentDisconnect;
}; cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) { m_HasSentDisconnect = false; }
} PlayerCallback(m_Server->GetShutdownMessage());
if (m_Server->GetNumPlayers()) cRoot::Get()->ForEachPlayer(PlayerCallback);
if (PlayerCallback.m_HasSentDisconnect)
{ {
cPlayerCallback PlayerCallback((m_Server->GetShutdownMessage()));
cRoot::Get()->ForEachPlayer(PlayerCallback);
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
} }
m_TerminateEventRaised = true; m_TerminateEventRaised = true;