1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Replace thread approach with callback based

This commit is contained in:
nordsoft
2023-08-11 20:04:14 +04:00
parent ef7008a753
commit 70d04ad957
4 changed files with 21 additions and 26 deletions

View File

@@ -140,6 +140,7 @@ void CServerHandler::resetStateForLobby(const StartInfo::EMode mode, const std::
{
hostClientId = -1;
state = EClientState::NONE;
mapToStart = nullptr;
th = std::make_unique<CStopWatch>();
packsForLobbyScreen.clear();
c.reset();
@@ -396,6 +397,7 @@ void CServerHandler::sendClientDisconnecting()
return;
state = EClientState::DISCONNECTING;
mapToStart = nullptr;
LobbyClientDisconnected lcd;
lcd.clientId = c->connectionID;
logNetwork->info("Connection has been requested to be closed.");
@@ -553,6 +555,11 @@ void CServerHandler::sendStartGame(bool allowOnlyAI) const
c->disableStackSendingByID();
}
void CServerHandler::startMapAfterConnection(std::shared_ptr<CMapInfo> to)
{
mapToStart = to;
}
void CServerHandler::startGameplay(VCMI_LIB_WRAP_NAMESPACE(CGameState) * gameState)
{
if(CMM)