1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Simplify networking code on server

This commit is contained in:
Ivan Savenko
2023-12-26 18:29:13 +02:00
parent c9765a52ff
commit d6869160c5
3 changed files with 44 additions and 37 deletions

View File

@@ -63,15 +63,17 @@ void ApplyOnServerAfterAnnounceNetPackVisitor::visitLobbyClientConnected(LobbyCl
// Until UUID set we only pass LobbyClientConnected to this client
pack.c->uuid = pack.uuid;
srv.updateAndPropagateLobbyState();
if(srv.getState() == EServerState::GAMEPLAY)
{
//immediately start game
std::unique_ptr<LobbyStartGame> startGameForReconnectedPlayer(new LobbyStartGame);
startGameForReconnectedPlayer->initializedStartInfo = srv.si;
startGameForReconnectedPlayer->initializedGameState = srv.gh->gameState();
startGameForReconnectedPlayer->clientId = pack.c->connectionID;
srv.announcePack(std::move(startGameForReconnectedPlayer));
}
// FIXME: what is this??? We do NOT support reconnection into ongoing game - at the very least queries and battles are NOT serialized
// if(srv.getState() == EServerState::GAMEPLAY)
// {
// //immediately start game
// std::unique_ptr<LobbyStartGame> startGameForReconnectedPlayer(new LobbyStartGame);
// startGameForReconnectedPlayer->initializedStartInfo = srv.si;
// startGameForReconnectedPlayer->initializedGameState = srv.gh->gameState();
// startGameForReconnectedPlayer->clientId = pack.c->connectionID;
// srv.announcePack(std::move(startGameForReconnectedPlayer));
// }
}
void ClientPermissionsCheckerNetPackVisitor::visitLobbyClientDisconnected(LobbyClientDisconnected & pack)