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

Fixes and cleanup of game client network shutdown and restart

This commit is contained in:
Ivan Savenko
2024-02-03 19:08:45 +02:00
parent 6eef197cea
commit 2c2bec791c
17 changed files with 102 additions and 146 deletions

View File

@@ -111,7 +111,6 @@ class CServerHandler final : public IServerAPI, public LobbyInfo, public INetwor
/// required to correctly deserialize gamestate using client-side game callback
std::unique_ptr<CClient> nextClient;
void onServerFinished();
void sendLobbyPack(const CPackForLobby & pack) const override;
void onPacketReceived(const NetworkConnectionPtr &, const std::vector<std::byte> & message) override;
@@ -145,13 +144,11 @@ public:
////////////////////
std::unique_ptr<CStopWatch> th;
std::unique_ptr<boost::thread> threadRunLocalServer;
std::unique_ptr<boost::thread> threadNetwork;
boost::thread threadRunLocalServer;
boost::thread threadNetwork;
std::unique_ptr<CClient> client;
CondSh<bool> campaignServerRestartLock;
CServerHandler();
~CServerHandler();
@@ -202,7 +199,8 @@ public:
void debugStartTest(std::string filename, bool save = false);
void startGameplay(VCMI_LIB_WRAP_NAMESPACE(CGameState) * gameState = nullptr);
void endGameplay(bool closeConnection = true, bool restart = false);
void endGameplay();
void restartGameplay();
void startCampaignScenario(HighScoreParameter param, std::shared_ptr<CampaignState> cs = {});
void showServerError(const std::string & txt) const;