1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Fix UUID initialization on client

This commit is contained in:
Ivan Savenko
2023-12-26 19:50:44 +02:00
parent 2396c14114
commit 0196707083
3 changed files with 4 additions and 8 deletions

View File

@ -138,18 +138,14 @@ CServerHandler::~CServerHandler()
CServerHandler::CServerHandler()
: state(EClientState::NONE)
, networkClient(std::make_unique<NetworkClient>(*this))
, applier(std::make_unique<CApplier<CBaseForLobbyApply>>())
, client(nullptr)
, loadMode(0)
, campaignStateToSend(nullptr)
, campaignServerRestartLock(false)
{
uuid = boost::uuids::to_string(boost::uuids::random_generator()());
//read from file to restore last session
if(!settings["server"]["uuid"].isNull() && !settings["server"]["uuid"].String().empty())
uuid = settings["server"]["uuid"].String();
applier = std::make_shared<CApplier<CBaseForLobbyApply>>();
registerTypesLobbyPacks(*applier);
threadNetwork = std::make_unique<boost::thread>(&CServerHandler::threadRunNetwork, this);
}
@ -314,6 +310,7 @@ void CServerHandler::onConnectionEstablished(const std::shared_ptr<NetworkConnec
{
logNetwork->info("Connection established");
c = std::make_shared<CConnection>(netConnection);
c->uuid = uuid;
c->enterLobbyConnectionMode();
sendClientConnecting();
}