1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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

@@ -38,7 +38,9 @@ void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyClientConnected(LobbyClientCon
if(pack.uuid == handler.c->uuid)
{
handler.c->connectionID = pack.clientId;
if(!settings["session"]["headless"].Bool())
if(handler.mapToStart)
handler.setMapInfo(handler.mapToStart);
else if(!settings["session"]["headless"].Bool())
GH.windows().createAndPushWindow<CLobbyScreen>(static_cast<ESelectionScreen>(handler.screenType));
handler.state = EClientState::LOBBY;
}
@@ -136,6 +138,11 @@ void ApplyOnLobbyHandlerNetPackVisitor::visitLobbyUpdateState(LobbyUpdateState &
{
pack.hostChanged = pack.state.hostClientId != handler.hostClientId;
static_cast<LobbyState &>(handler) = pack.state;
if(handler.mapToStart && handler.mi)
{
handler.startMapAfterConnection(nullptr);
handler.sendStartGame();
}
}
void ApplyOnLobbyScreenNetPackVisitor::visitLobbyUpdateState(LobbyUpdateState & pack)