diff options
Diffstat (limited to 'NorthstarDLL/masterserver.cpp')
-rw-r--r-- | NorthstarDLL/masterserver.cpp | 204 |
1 files changed, 102 insertions, 102 deletions
diff --git a/NorthstarDLL/masterserver.cpp b/NorthstarDLL/masterserver.cpp index d5ef2d9f..62d037be 100644 --- a/NorthstarDLL/masterserver.cpp +++ b/NorthstarDLL/masterserver.cpp @@ -109,8 +109,8 @@ std::string unescape_unicode(const std::string& str) void UpdateServerInfoFromUnicodeToUTF8() { - g_MasterServerManager->ns_auth_srvName = unescape_unicode(Cvar_ns_server_name->GetString()); - g_MasterServerManager->ns_auth_srvDesc = unescape_unicode(Cvar_ns_server_desc->GetString()); + g_MasterServerManager->m_sUnicodeServerName = unescape_unicode(Cvar_ns_server_name->GetString()); + g_MasterServerManager->m_sUnicodeServerDesc = unescape_unicode(Cvar_ns_server_desc->GetString()); } const char* HttplibErrorToString(httplib::Error error) @@ -191,11 +191,11 @@ void MasterServerManager::SetCommonHttpClientOptions(CURL* curl) void MasterServerManager::ClearServerList() { // this doesn't really do anything lol, probably isn't threadsafe - m_requestingServerList = true; + m_bRequestingServerList = true; - m_remoteServers.clear(); + m_vRemoteServers.clear(); - m_requestingServerList = false; + m_bRequestingServerList = false; } size_t CurlWriteToStringBufferCallback(char* contents, size_t size, size_t nmemb, void* userp) @@ -234,7 +234,7 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or if (result == CURLcode::CURLE_OK) { - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; rapidjson_document originAuthInfo; originAuthInfo.Parse(readBuffer.c_str()); @@ -255,8 +255,8 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or if (originAuthInfo["success"].IsTrue() && originAuthInfo.HasMember("token") && originAuthInfo["token"].IsString()) { - strncpy(m_ownClientAuthToken, originAuthInfo["token"].GetString(), sizeof(m_ownClientAuthToken)); - m_ownClientAuthToken[sizeof(m_ownClientAuthToken) - 1] = 0; + strncpy(m_sOwnClientAuthToken, originAuthInfo["token"].GetString(), sizeof(m_sOwnClientAuthToken)); + m_sOwnClientAuthToken[sizeof(m_sOwnClientAuthToken) - 1] = 0; spdlog::info("Northstar origin authentication completed successfully!"); } else @@ -265,7 +265,7 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or else { spdlog::error("Failed performing northstar origin auth: error {}", curl_easy_strerror(result)); - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; } // we goto this instead of returning so we always hit this @@ -281,18 +281,18 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or void MasterServerManager::RequestServerList() { // do this here so it's instantly set on call for scripts - m_scriptRequestingServerList = true; + m_bScriptRequestingServerList = true; std::thread requestThread( [this]() { // make sure we never have 2 threads writing at once // i sure do hope this is actually threadsafe - while (m_requestingServerList) + while (m_bRequestingServerList) Sleep(100); - m_requestingServerList = true; - m_scriptRequestingServerList = true; + m_bRequestingServerList = true; + m_bScriptRequestingServerList = true; spdlog::info("Requesting server list from {}", Cvar_ns_masterserver_hostname->GetString()); @@ -309,7 +309,7 @@ void MasterServerManager::RequestServerList() if (result == CURLcode::CURLE_OK) { - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; rapidjson_document serverInfoJson; serverInfoJson.Parse(readBuffer.c_str()); @@ -347,7 +347,7 @@ void MasterServerManager::RequestServerList() goto REQUEST_END_CLEANUP; } - // todo: verify json props are fine before adding to m_remoteServers + // todo: verify json props are fine before adding to m_vRemoteServers if (!serverObj.HasMember("id") || !serverObj["id"].IsString() || !serverObj.HasMember("name") || !serverObj["name"].IsString() || !serverObj.HasMember("description") || !serverObj["description"].IsString() || !serverObj.HasMember("map") || !serverObj["map"].IsString() || !serverObj.HasMember("playlist") || @@ -365,7 +365,7 @@ void MasterServerManager::RequestServerList() RemoteServerInfo* newServer = nullptr; bool createNewServerInfo = true; - for (RemoteServerInfo& server : m_remoteServers) + for (RemoteServerInfo& server : m_vRemoteServers) { // if server already exists, update info rather than adding to it if (!strncmp((const char*)server.id, id, 32)) @@ -387,7 +387,7 @@ void MasterServerManager::RequestServerList() // server didn't exist if (createNewServerInfo) - newServer = &m_remoteServers.emplace_back( + newServer = &m_vRemoteServers.emplace_back( id, serverObj["name"].GetString(), serverObj["description"].GetString(), @@ -424,20 +424,20 @@ void MasterServerManager::RequestServerList() } std::sort( - m_remoteServers.begin(), - m_remoteServers.end(), + m_vRemoteServers.begin(), + m_vRemoteServers.end(), [](RemoteServerInfo& a, RemoteServerInfo& b) { return a.playerCount > b.playerCount; }); } else { spdlog::error("Failed requesting servers: error {}", curl_easy_strerror(result)); - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; } // we goto this instead of returning so we always hit this REQUEST_END_CLEANUP: - m_requestingServerList = false; - m_scriptRequestingServerList = false; + m_bRequestingServerList = false; + m_bScriptRequestingServerList = false; curl_easy_cleanup(curl); }); @@ -468,7 +468,7 @@ void MasterServerManager::RequestMainMenuPromos() if (result == CURLcode::CURLE_OK) { - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; rapidjson_document mainMenuPromoJson; mainMenuPromoJson.Parse(readBuffer.c_str()); @@ -526,29 +526,29 @@ void MasterServerManager::RequestMainMenuPromos() goto REQUEST_END_CLEANUP; } - m_MainMenuPromoData.newInfoTitle1 = mainMenuPromoJson["newInfo"]["Title1"].GetString(); - m_MainMenuPromoData.newInfoTitle2 = mainMenuPromoJson["newInfo"]["Title2"].GetString(); - m_MainMenuPromoData.newInfoTitle3 = mainMenuPromoJson["newInfo"]["Title3"].GetString(); + m_sMainMenuPromoData.newInfoTitle1 = mainMenuPromoJson["newInfo"]["Title1"].GetString(); + m_sMainMenuPromoData.newInfoTitle2 = mainMenuPromoJson["newInfo"]["Title2"].GetString(); + m_sMainMenuPromoData.newInfoTitle3 = mainMenuPromoJson["newInfo"]["Title3"].GetString(); - m_MainMenuPromoData.largeButtonTitle = mainMenuPromoJson["largeButton"]["Title"].GetString(); - m_MainMenuPromoData.largeButtonText = mainMenuPromoJson["largeButton"]["Text"].GetString(); - m_MainMenuPromoData.largeButtonUrl = mainMenuPromoJson["largeButton"]["Url"].GetString(); - m_MainMenuPromoData.largeButtonImageIndex = mainMenuPromoJson["largeButton"]["ImageIndex"].GetInt(); + m_sMainMenuPromoData.largeButtonTitle = mainMenuPromoJson["largeButton"]["Title"].GetString(); + m_sMainMenuPromoData.largeButtonText = mainMenuPromoJson["largeButton"]["Text"].GetString(); + m_sMainMenuPromoData.largeButtonUrl = mainMenuPromoJson["largeButton"]["Url"].GetString(); + m_sMainMenuPromoData.largeButtonImageIndex = mainMenuPromoJson["largeButton"]["ImageIndex"].GetInt(); - m_MainMenuPromoData.smallButton1Title = mainMenuPromoJson["smallButton1"]["Title"].GetString(); - m_MainMenuPromoData.smallButton1Url = mainMenuPromoJson["smallButton1"]["Url"].GetString(); - m_MainMenuPromoData.smallButton1ImageIndex = mainMenuPromoJson["smallButton1"]["ImageIndex"].GetInt(); + m_sMainMenuPromoData.smallButton1Title = mainMenuPromoJson["smallButton1"]["Title"].GetString(); + m_sMainMenuPromoData.smallButton1Url = mainMenuPromoJson["smallButton1"]["Url"].GetString(); + m_sMainMenuPromoData.smallButton1ImageIndex = mainMenuPromoJson["smallButton1"]["ImageIndex"].GetInt(); - m_MainMenuPromoData.smallButton2Title = mainMenuPromoJson["smallButton2"]["Title"].GetString(); - m_MainMenuPromoData.smallButton2Url = mainMenuPromoJson["smallButton2"]["Url"].GetString(); - m_MainMenuPromoData.smallButton2ImageIndex = mainMenuPromoJson["smallButton2"]["ImageIndex"].GetInt(); + m_sMainMenuPromoData.smallButton2Title = mainMenuPromoJson["smallButton2"]["Title"].GetString(); + m_sMainMenuPromoData.smallButton2Url = mainMenuPromoJson["smallButton2"]["Url"].GetString(); + m_sMainMenuPromoData.smallButton2ImageIndex = mainMenuPromoJson["smallButton2"]["ImageIndex"].GetInt(); m_bHasMainMenuPromoData = true; } else { spdlog::error("Failed requesting main menu promos: error {}", curl_easy_strerror(result)); - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; } REQUEST_END_CLEANUP: @@ -562,12 +562,12 @@ void MasterServerManager::RequestMainMenuPromos() void MasterServerManager::AuthenticateWithOwnServer(char* uid, char* playerToken) { // dont wait, just stop if we're trying to do 2 auth requests at once - if (m_authenticatingWithGameServer) + if (m_bAuthenticatingWithGameServer) return; - m_authenticatingWithGameServer = true; - m_scriptAuthenticatingWithGameServer = true; - m_successfullyAuthenticatedWithGameServer = false; + m_bAuthenticatingWithGameServer = true; + m_bScriptAuthenticatingWithGameServer = true; + m_bSuccessfullyAuthenticatedWithGameServer = false; std::string uidStr(uid); std::string tokenStr(playerToken); @@ -592,7 +592,7 @@ void MasterServerManager::AuthenticateWithOwnServer(char* uid, char* playerToken if (result == CURLcode::CURLE_OK) { - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; rapidjson_document authInfoJson; authInfoJson.Parse(readBuffer.c_str()); @@ -662,19 +662,19 @@ void MasterServerManager::AuthenticateWithOwnServer(char* uid, char* playerToken g_ServerAuthenticationManager->m_authData.clear(); g_ServerAuthenticationManager->m_authData.insert(std::make_pair(authInfoJson["authToken"].GetString(), newAuthData)); - m_successfullyAuthenticatedWithGameServer = true; + m_bSuccessfullyAuthenticatedWithGameServer = true; } else { spdlog::error("Failed authenticating with own server: error {}", curl_easy_strerror(result)); - m_successfullyConnected = false; - m_successfullyAuthenticatedWithGameServer = false; - m_scriptAuthenticatingWithGameServer = false; + m_bSuccessfullyConnected = false; + m_bSuccessfullyAuthenticatedWithGameServer = false; + m_bScriptAuthenticatingWithGameServer = false; } REQUEST_END_CLEANUP: - m_authenticatingWithGameServer = false; - m_scriptAuthenticatingWithGameServer = false; + m_bAuthenticatingWithGameServer = false; + m_bScriptAuthenticatingWithGameServer = false; if (m_bNewgameAfterSelfAuth) { @@ -692,12 +692,12 @@ void MasterServerManager::AuthenticateWithOwnServer(char* uid, char* playerToken void MasterServerManager::AuthenticateWithServer(char* uid, char* playerToken, char* serverId, char* password) { // dont wait, just stop if we're trying to do 2 auth requests at once - if (m_authenticatingWithGameServer) + if (m_bAuthenticatingWithGameServer) return; - m_authenticatingWithGameServer = true; - m_scriptAuthenticatingWithGameServer = true; - m_successfullyAuthenticatedWithGameServer = false; + m_bAuthenticatingWithGameServer = true; + m_bScriptAuthenticatingWithGameServer = true; + m_bSuccessfullyAuthenticatedWithGameServer = false; std::string uidStr(uid); std::string tokenStr(playerToken); @@ -708,7 +708,7 @@ void MasterServerManager::AuthenticateWithServer(char* uid, char* playerToken, c [this, uidStr, tokenStr, serverIdStr, passwordStr]() { // esnure that any persistence saving is done, so we know masterserver has newest - while (m_savingPersistentData) + while (m_bSavingPersistentData) Sleep(100); spdlog::info("Attempting authentication with server of id \"{}\"", serverIdStr); @@ -743,7 +743,7 @@ void MasterServerManager::AuthenticateWithServer(char* uid, char* playerToken, c if (result == CURLcode::CURLE_OK) { - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; rapidjson_document connectionInfoJson; connectionInfoJson.Parse(readBuffer.c_str()); @@ -794,20 +794,20 @@ void MasterServerManager::AuthenticateWithServer(char* uid, char* playerToken, c strncpy(m_pendingConnectionInfo.authToken, connectionInfoJson["authToken"].GetString(), 31); m_pendingConnectionInfo.authToken[31] = 0; - m_hasPendingConnectionInfo = true; - m_successfullyAuthenticatedWithGameServer = true; + m_bHasPendingConnectionInfo = true; + m_bSuccessfullyAuthenticatedWithGameServer = true; } else { spdlog::error("Failed authenticating with server: error {}", curl_easy_strerror(result)); - m_successfullyConnected = false; - m_successfullyAuthenticatedWithGameServer = false; - m_scriptAuthenticatingWithGameServer = false; + m_bSuccessfullyConnected = false; + m_bSuccessfullyAuthenticatedWithGameServer = false; + m_bScriptAuthenticatingWithGameServer = false; } REQUEST_END_CLEANUP: - m_authenticatingWithGameServer = false; - m_scriptAuthenticatingWithGameServer = false; + m_bAuthenticatingWithGameServer = false; + m_bScriptAuthenticatingWithGameServer = false; curl_easy_cleanup(curl); }); @@ -841,8 +841,8 @@ void MasterServerManager::AddSelfToServerList( int retry_counter = 0; START_REQUEST: - m_ownServerId[0] = 0; - m_ownServerAuthToken[0] = 0; + m_sOwnServerId[0] = 0; + m_sOwnServerAuthToken[0] = 0; CURL* curl = curl_easy_init(); SetCommonHttpClientOptions(curl); @@ -855,7 +855,7 @@ void MasterServerManager::AddSelfToServerList( curl_mime* mime = curl_mime_init(curl); curl_mimepart* part = curl_mime_addpart(mime); - curl_mime_data(part, m_ownModInfoJson.c_str(), m_ownModInfoJson.size()); + curl_mime_data(part, m_sOwnModInfoJson.c_str(), m_sOwnModInfoJson.size()); curl_mime_name(part, "modinfo"); curl_mime_filename(part, "modinfo.json"); curl_mime_type(part, "application/json"); @@ -897,7 +897,7 @@ void MasterServerManager::AddSelfToServerList( if (result == CURLcode::CURLE_OK) { - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; rapidjson_document serverAddedJson; serverAddedJson.Parse(readBuffer.c_str()); @@ -959,11 +959,11 @@ void MasterServerManager::AddSelfToServerList( goto REQUEST_END_CLEANUP; } - strncpy(m_ownServerId, serverAddedJson["id"].GetString(), sizeof(m_ownServerId)); - m_ownServerId[sizeof(m_ownServerId) - 1] = 0; + strncpy(m_sOwnServerId, serverAddedJson["id"].GetString(), sizeof(m_sOwnServerId)); + m_sOwnServerId[sizeof(m_sOwnServerId) - 1] = 0; - strncpy(m_ownServerAuthToken, serverAddedJson["serverAuthToken"].GetString(), sizeof(m_ownServerAuthToken)); - m_ownServerAuthToken[sizeof(m_ownServerAuthToken) - 1] = 0; + strncpy(m_sOwnServerAuthToken, serverAddedJson["serverAuthToken"].GetString(), sizeof(m_sOwnServerAuthToken)); + m_sOwnServerAuthToken[sizeof(m_sOwnServerAuthToken) - 1] = 0; spdlog::info("Succesfully added server to the master server."); @@ -975,7 +975,7 @@ void MasterServerManager::AddSelfToServerList( Sleep(5000); // defensive check, as m_ownServer could be set to null during the Sleep(5000) above - if (!*m_ownServerId) + if (!*m_sOwnServerId) return; do @@ -992,8 +992,8 @@ void MasterServerManager::AddSelfToServerList( // send all registration info so we have all necessary info to reregister our server if masterserver goes down, // without a restart this isn't threadsafe :terror: { - char* escapedNameNew = curl_easy_escape(curl, g_MasterServerManager->ns_auth_srvName.c_str(), NULL); - char* escapedDescNew = curl_easy_escape(curl, g_MasterServerManager->ns_auth_srvDesc.c_str(), NULL); + char* escapedNameNew = curl_easy_escape(curl, g_MasterServerManager->m_sUnicodeServerName.c_str(), NULL); + char* escapedDescNew = curl_easy_escape(curl, g_MasterServerManager->m_sUnicodeServerDesc.c_str(), NULL); char* escapedMapNew = curl_easy_escape(curl, g_pHostState->m_levelName, NULL); char* escapedPlaylistNew = curl_easy_escape(curl, GetCurrentPlaylistName(), NULL); char* escapedPasswordNew = curl_easy_escape(curl, Cvar_ns_server_password->GetString(), NULL); @@ -1011,7 +1011,7 @@ void MasterServerManager::AddSelfToServerList( "update_values?id={}&port={}&authPort={}&name={}&description={}&map={}&playlist={}&playerCount={}&" "maxPlayers={}&password={}", Cvar_ns_masterserver_hostname->GetString(), - m_ownServerId, + m_sOwnServerId, Cvar_hostport->GetInt(), Cvar_ns_player_auth_port->GetInt(), escapedNameNew, @@ -1033,7 +1033,7 @@ void MasterServerManager::AddSelfToServerList( curl_mime* mime = curl_mime_init(curl); curl_mimepart* part = curl_mime_addpart(mime); - curl_mime_data(part, m_ownModInfoJson.c_str(), m_ownModInfoJson.size()); + curl_mime_data(part, m_sOwnModInfoJson.c_str(), m_sOwnModInfoJson.size()); curl_mime_name(part, "modinfo"); curl_mime_filename(part, "modinfo.json"); curl_mime_type(part, "application/json"); @@ -1042,8 +1042,8 @@ void MasterServerManager::AddSelfToServerList( CURLcode result = curl_easy_perform(curl); - // defensive check, as m_ownServerId could be set to null before this request gets processed - if (!*m_ownServerId) + // defensive check, as m_sOwnServerId could be set to null before this request gets processed + if (!*m_sOwnServerId) return; if (result == CURLcode::CURLE_OK) @@ -1055,17 +1055,17 @@ void MasterServerManager::AddSelfToServerList( { if (serverAddedJson.HasMember("id") && serverAddedJson["id"].IsString()) { - strncpy(m_ownServerId, serverAddedJson["id"].GetString(), sizeof(m_ownServerId)); - m_ownServerId[sizeof(m_ownServerId) - 1] = 0; + strncpy(m_sOwnServerId, serverAddedJson["id"].GetString(), sizeof(m_sOwnServerId)); + m_sOwnServerId[sizeof(m_sOwnServerId) - 1] = 0; } if (serverAddedJson.HasMember("serverAuthToken") && serverAddedJson["serverAuthToken"].IsString()) { strncpy( - m_ownServerAuthToken, + m_sOwnServerAuthToken, serverAddedJson["serverAuthToken"].GetString(), - sizeof(m_ownServerAuthToken)); - m_ownServerAuthToken[sizeof(m_ownServerAuthToken) - 1] = 0; + sizeof(m_sOwnServerAuthToken)); + m_sOwnServerAuthToken[sizeof(m_sOwnServerAuthToken) - 1] = 0; } } } @@ -1074,7 +1074,7 @@ void MasterServerManager::AddSelfToServerList( curl_easy_cleanup(curl); Sleep(10000); - } while (*m_ownServerId); + } while (*m_sOwnServerId); }); heartbeatThread.detach(); @@ -1082,7 +1082,7 @@ void MasterServerManager::AddSelfToServerList( else { spdlog::error("Failed adding self to server list: error {}", curl_easy_strerror(result)); - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; } REQUEST_END_CLEANUP: @@ -1096,7 +1096,7 @@ void MasterServerManager::AddSelfToServerList( void MasterServerManager::UpdateServerMapAndPlaylist(char* map, char* playlist, int maxPlayers) { // dont call this if we don't have a server id - if (!*m_ownServerId) + if (!*m_sOwnServerId) return; std::string strMap(map); @@ -1124,7 +1124,7 @@ void MasterServerManager::UpdateServerMapAndPlaylist(char* map, char* playlist, fmt::format( "{}/server/update_values?id={}&map={}&playlist={}&maxPlayers={}", Cvar_ns_masterserver_hostname->GetString(), - m_ownServerId, + m_sOwnServerId, mapEscaped, playlistEscaped, maxPlayers) @@ -1137,9 +1137,9 @@ void MasterServerManager::UpdateServerMapAndPlaylist(char* map, char* playlist, CURLcode result = curl_easy_perform(curl); if (result == CURLcode::CURLE_OK) - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; else - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; curl_easy_cleanup(curl); }); @@ -1150,7 +1150,7 @@ void MasterServerManager::UpdateServerMapAndPlaylist(char* map, char* playlist, void MasterServerManager::UpdateServerPlayerCount(int playerCount) { // dont call this if we don't have a server id - if (!*m_ownServerId) + if (!*m_sOwnServerId) return; std::thread requestThread( @@ -1167,15 +1167,15 @@ void MasterServerManager::UpdateServerPlayerCount(int playerCount) curl, CURLOPT_URL, fmt::format( - "{}/server/update_values?id={}&playerCount={}", Cvar_ns_masterserver_hostname->GetString(), m_ownServerId, playerCount) + "{}/server/update_values?id={}&playerCount={}", Cvar_ns_masterserver_hostname->GetString(), m_sOwnServerId, playerCount) .c_str()); CURLcode result = curl_easy_perform(curl); if (result == CURLcode::CURLE_OK) - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; else - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; curl_easy_cleanup(curl); }); @@ -1186,7 +1186,7 @@ void MasterServerManager::UpdateServerPlayerCount(int playerCount) void MasterServerManager::WritePlayerPersistentData(char* playerId, char* pdata, size_t pdataSize) { // still call this if we don't have a server id, since lobbies that aren't port forwarded need to be able to call it - m_savingPersistentData = true; + m_bSavingPersistentData = true; if (!pdataSize) { spdlog::warn("attempted to write pdata of size 0!"); @@ -1210,7 +1210,7 @@ void MasterServerManager::WritePlayerPersistentData(char* playerId, char* pdata, "{}/accounts/write_persistence?id={}&serverId={}", Cvar_ns_masterserver_hostname->GetString(), strPlayerId, - m_ownServerId) + m_sOwnServerId) .c_str()); curl_easy_setopt(curl, CURLOPT_POST, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); @@ -1229,13 +1229,13 @@ void MasterServerManager::WritePlayerPersistentData(char* playerId, char* pdata, CURLcode result = curl_easy_perform(curl); if (result == CURLcode::CURLE_OK) - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; else - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; curl_easy_cleanup(curl); - m_savingPersistentData = false; + m_bSavingPersistentData = false; }); requestThread.detach(); @@ -1244,7 +1244,7 @@ void MasterServerManager::WritePlayerPersistentData(char* playerId, char* pdata, void MasterServerManager::RemoveSelfFromServerList() { // dont call this if we don't have a server id - if (!*m_ownServerId || !Cvar_ns_report_server_to_masterserver->GetBool()) + if (!*m_sOwnServerId || !Cvar_ns_report_server_to_masterserver->GetBool()) return; std::thread requestThread( @@ -1260,15 +1260,15 @@ void MasterServerManager::RemoveSelfFromServerList() curl_easy_setopt( curl, CURLOPT_URL, - fmt::format("{}/server/remove_server?id={}", Cvar_ns_masterserver_hostname->GetString(), m_ownServerId).c_str()); + fmt::format("{}/server/remove_server?id={}", Cvar_ns_masterserver_hostname->GetString(), m_sOwnServerId).c_str()); - *m_ownServerId = 0; + *m_sOwnServerId = 0; CURLcode result = curl_easy_perform(curl); if (result == CURLcode::CURLE_OK) - m_successfullyConnected = true; + m_bSuccessfullyConnected = true; else - m_successfullyConnected = false; + m_bSuccessfullyConnected = false; curl_easy_cleanup(curl); }); @@ -1365,7 +1365,7 @@ void CHostState__State_GameShutdownHook(CHostState* hostState) CHostState__State_GameShutdown(hostState); } -MasterServerManager::MasterServerManager() : m_pendingConnectionInfo {}, m_ownServerId {""}, m_ownClientAuthToken {""} {} +MasterServerManager::MasterServerManager() : m_pendingConnectionInfo {}, m_sOwnServerId {""}, m_sOwnClientAuthToken {""} {} void InitialiseSharedMasterServer(HMODULE baseAddress) { |