1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Moved management of turn order into a new class

This commit is contained in:
Ivan Savenko
2023-08-22 18:45:13 +03:00
parent 979cf129bc
commit c4bc6840ea
17 changed files with 341 additions and 271 deletions

View File

@@ -158,6 +158,16 @@ CVCMIServer::~CVCMIServer()
announceLobbyThread->join();
}
void CVCMIServer::setState(EServerState value)
{
state.store(value);
}
EServerState CVCMIServer::getState() const
{
return state.load();
}
void CVCMIServer::run()
{
if(!restartGameplay)
@@ -1159,7 +1169,7 @@ int main(int argc, const char * argv[])
try
{
while(server.state != EServerState::SHUTDOWN)
while(server.getState() != EServerState::SHUTDOWN)
{
server.run();
}
@@ -1168,7 +1178,7 @@ int main(int argc, const char * argv[])
catch(boost::system::system_error & e) //for boost errors just log, not crash - probably client shut down connection
{
logNetwork->error(e.what());
server.state = EServerState::SHUTDOWN;
server.setState(EServerState::SHUTDOWN);
}
}
catch(boost::system::system_error & e)