From 6b84f1d4e37dfcca2e48acd5a3968707c23d568b Mon Sep 17 00:00:00 2001
From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>
Date: Thu, 8 Sep 2022 00:16:19 +0200
Subject: Rename some members of MasterServerManager (#266)
This is basically 9ab7c43c34183915273cc8b5ccedd72568249b27 from refactor but without the debug build crash fix as that was introduced in a commit in refactor not present on main
Co-authored-by: BobTheBob <32057864+BobTheBob9@users.noreply.github.com>
---
NorthstarDLL/NorthstarDLL.vcxproj.filters | 10 +-
NorthstarDLL/dedicated.cpp | 4 +-
NorthstarDLL/masterserver.cpp | 204 +++++++++++++++---------------
NorthstarDLL/masterserver.h | 32 ++---
NorthstarDLL/misccommands.cpp | 2 +-
NorthstarDLL/miscserverscript.cpp | 2 +-
NorthstarDLL/modmanager.cpp | 2 +-
NorthstarDLL/playlist.cpp | 2 +-
NorthstarDLL/plugins.cpp | 2 +-
NorthstarDLL/scriptmainmenupromos.cpp | 26 ++--
NorthstarDLL/scriptserverbrowser.cpp | 98 +++++++-------
NorthstarDLL/serverauthentication.cpp | 2 +-
12 files changed, 193 insertions(+), 193 deletions(-)
diff --git a/NorthstarDLL/NorthstarDLL.vcxproj.filters b/NorthstarDLL/NorthstarDLL.vcxproj.filters
index 2be53e83..4237492e 100644
--- a/NorthstarDLL/NorthstarDLL.vcxproj.filters
+++ b/NorthstarDLL/NorthstarDLL.vcxproj.filters
@@ -25,9 +25,6 @@
{4f525372-34a8-40b3-8a95-81d77cdfcf7f}
-
- {947835db-67d6-42c0-870d-62743f85231f}
-
{8b8ed12a-9269-4dc3-b932-0daefdf6a388}
@@ -133,6 +130,9 @@
{b30e08b1-b962-4264-8cbb-a0a31924b93e}
+
+ {947835db-67d6-42c0-870d-62743f85231f}
+
{7f609cee-d2c0-46a2-b06e-83b9f0511915}
@@ -1533,7 +1533,7 @@
Source Files\Shared\Hooks
- Source Files\Dedicated
+ Source Files\Server\Dedicated
Source Files\Client
@@ -1596,7 +1596,7 @@
Source Files\Server
- Source Files\Dedicated
+ Source Files\Server\Dedicated
Source Files\Shared\Convar
diff --git a/NorthstarDLL/dedicated.cpp b/NorthstarDLL/dedicated.cpp
index d2a89f6a..e6394aee 100644
--- a/NorthstarDLL/dedicated.cpp
+++ b/NorthstarDLL/dedicated.cpp
@@ -30,7 +30,7 @@ struct CDedicatedExports
void Sys_Printf(CDedicatedExports* dedicated, const char* msg)
{
- spdlog::info("[DEDICATED PRINT] {}", msg);
+ spdlog::info("[DEDICATED SERVER] {}", msg);
}
typedef void (*CHostState__InitType)(CHostState* self);
@@ -81,7 +81,7 @@ void RunServer(CDedicatedExports* dedicated)
SetConsoleTitleA(fmt::format(
"{} - {} {}/{} players ({})",
- g_MasterServerManager->ns_auth_srvName,
+ g_MasterServerManager->m_sUnicodeServerName,
g_pHostState->m_levelName,
g_ServerAuthenticationManager->m_additionalPlayerData.size(),
maxPlayers,
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)
{
diff --git a/NorthstarDLL/masterserver.h b/NorthstarDLL/masterserver.h
index e4dcb954..3d5f716c 100644
--- a/NorthstarDLL/masterserver.h
+++ b/NorthstarDLL/masterserver.h
@@ -73,40 +73,40 @@ struct MainMenuPromoData
class MasterServerManager
{
private:
- bool m_requestingServerList = false;
- bool m_authenticatingWithGameServer = false;
+ bool m_bRequestingServerList = false;
+ bool m_bAuthenticatingWithGameServer = false;
public:
- char m_ownServerId[33];
- char m_ownServerAuthToken[33];
- char m_ownClientAuthToken[33];
+ char m_sOwnServerId[33];
+ char m_sOwnServerAuthToken[33];
+ char m_sOwnClientAuthToken[33];
- std::string m_ownModInfoJson;
- std::string ns_auth_srvName; // Unicode unescaped version of Cvar_ns_auth_servername for support in cjk characters
- std::string ns_auth_srvDesc; // Unicode unescaped version of Cvar_ns_auth_serverdesc for support in cjk characters
+ std::string m_sOwnModInfoJson;
+ std::string m_sUnicodeServerName; // Unicode unescaped version of Cvar_ns_auth_servername for support in cjk characters
+ std::string m_sUnicodeServerDesc; // Unicode unescaped version of Cvar_ns_auth_serverdesc for support in cjk characters
bool m_bOriginAuthWithMasterServerDone = false;
bool m_bOriginAuthWithMasterServerInProgress = false;
bool m_bRequireClientAuth = false;
- bool m_savingPersistentData = false;
+ bool m_bSavingPersistentData = false;
- bool m_scriptRequestingServerList = false;
- bool m_successfullyConnected = true;
+ bool m_bScriptRequestingServerList = false;
+ bool m_bSuccessfullyConnected = true;
bool m_bNewgameAfterSelfAuth = false;
- bool m_scriptAuthenticatingWithGameServer = false;
- bool m_successfullyAuthenticatedWithGameServer = false;
+ bool m_bScriptAuthenticatingWithGameServer = false;
+ bool m_bSuccessfullyAuthenticatedWithGameServer = false;
std::string s_authfail_reason {};
- bool m_hasPendingConnectionInfo = false;
+ bool m_bHasPendingConnectionInfo = false;
RemoteServerConnectionInfo m_pendingConnectionInfo;
- std::vector m_remoteServers;
+ std::vector m_vRemoteServers;
bool m_bHasMainMenuPromoData = false;
- MainMenuPromoData m_MainMenuPromoData;
+ MainMenuPromoData m_sMainMenuPromoData;
private:
void SetCommonHttpClientOptions(CURL* curl);
diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp
index 42ec15af..a05435b7 100644
--- a/NorthstarDLL/misccommands.cpp
+++ b/NorthstarDLL/misccommands.cpp
@@ -29,7 +29,7 @@ void AddMiscConCommands()
{
// hack for special case where we're on a local server, so we erase our own newly created auth data on disconnect
g_MasterServerManager->m_bNewgameAfterSelfAuth = true;
- g_MasterServerManager->AuthenticateWithOwnServer(g_LocalPlayerUserID, g_MasterServerManager->m_ownClientAuthToken);
+ g_MasterServerManager->AuthenticateWithOwnServer(g_LocalPlayerUserID, g_MasterServerManager->m_sOwnClientAuthToken);
});
// this is a concommand because we make a deferred call to it from another thread
diff --git a/NorthstarDLL/miscserverscript.cpp b/NorthstarDLL/miscserverscript.cpp
index c371da81..e6ddd58b 100644
--- a/NorthstarDLL/miscserverscript.cpp
+++ b/NorthstarDLL/miscserverscript.cpp
@@ -39,7 +39,7 @@ SQRESULT SQ_EarlyWritePlayerIndexPersistenceForLeave(void* sqvm)
// bool function NSIsWritingPlayerPersistence()
SQRESULT SQ_IsWritingPlayerPersistence(void* sqvm)
{
- ServerSq_pushbool(sqvm, g_MasterServerManager->m_savingPersistentData);
+ ServerSq_pushbool(sqvm, g_MasterServerManager->m_bSavingPersistentData);
return SQRESULT_NOTNULL;
}
diff --git a/NorthstarDLL/modmanager.cpp b/NorthstarDLL/modmanager.cpp
index 868d6cff..41391e11 100644
--- a/NorthstarDLL/modmanager.cpp
+++ b/NorthstarDLL/modmanager.cpp
@@ -535,7 +535,7 @@ void ModManager::LoadMods()
buffer.Clear();
rapidjson::Writer writer(buffer);
modinfoDoc.Accept(writer);
- g_MasterServerManager->m_ownModInfoJson = std::string(buffer.GetString());
+ g_MasterServerManager->m_sOwnModInfoJson = std::string(buffer.GetString());
m_hasLoadedMods = true;
}
diff --git a/NorthstarDLL/playlist.cpp b/NorthstarDLL/playlist.cpp
index e55710c3..21374607 100644
--- a/NorthstarDLL/playlist.cpp
+++ b/NorthstarDLL/playlist.cpp
@@ -1,5 +1,6 @@
#include "pch.h"
#include "playlist.h"
+#include "nsmem.h"
#include "concommand.h"
#include "convar.h"
#include "gameutils.h"
@@ -71,7 +72,6 @@ int GetCurrentGamemodeMaxPlayersHook()
return maxPlayers;
}
-#include "nsmem.h"
void InitialisePlaylistHooks(HMODULE baseAddress)
{
RegisterConCommand("setplaylist", SetPlaylistCommand, "Sets the current playlist", FCVAR_NONE);
diff --git a/NorthstarDLL/plugins.cpp b/NorthstarDLL/plugins.cpp
index 70535a32..57701fcd 100644
--- a/NorthstarDLL/plugins.cpp
+++ b/NorthstarDLL/plugins.cpp
@@ -192,7 +192,7 @@ SQRESULT SQ_SetConnected(void* sqvm)
SQRESULT SQ_UpdateListenServer(void* sqvm)
{
AcquireSRWLockExclusive(&serverInfoLock);
- serverInfo.id = g_MasterServerManager->m_ownServerId;
+ serverInfo.id = g_MasterServerManager->m_sOwnServerId;
serverInfo.password = Cvar_ns_server_password->GetString();
ReleaseSRWLockExclusive(&serverInfoLock);
return SQRESULT_NOTNULL;
diff --git a/NorthstarDLL/scriptmainmenupromos.cpp b/NorthstarDLL/scriptmainmenupromos.cpp
index eb56a88d..e26d1df6 100644
--- a/NorthstarDLL/scriptmainmenupromos.cpp
+++ b/NorthstarDLL/scriptmainmenupromos.cpp
@@ -48,79 +48,79 @@ SQRESULT SQ_GetCustomMainMenuPromoData(void* sqvm)
{
case eMainMenuPromoDataProperty::newInfoTitle1:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.newInfoTitle1.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.newInfoTitle1.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::newInfoTitle2:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.newInfoTitle2.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.newInfoTitle2.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::newInfoTitle3:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.newInfoTitle3.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.newInfoTitle3.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::largeButtonTitle:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.largeButtonTitle.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.largeButtonTitle.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::largeButtonText:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.largeButtonText.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.largeButtonText.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::largeButtonUrl:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.largeButtonUrl.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.largeButtonUrl.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::largeButtonImageIndex:
{
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_MainMenuPromoData.largeButtonImageIndex);
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_sMainMenuPromoData.largeButtonImageIndex);
break;
}
case eMainMenuPromoDataProperty::smallButton1Title:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.smallButton1Title.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.smallButton1Title.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::smallButton1Url:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.smallButton1Url.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.smallButton1Url.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::smallButton1ImageIndex:
{
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_MainMenuPromoData.smallButton1ImageIndex);
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_sMainMenuPromoData.smallButton1ImageIndex);
break;
}
case eMainMenuPromoDataProperty::smallButton2Title:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.smallButton2Title.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.smallButton2Title.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::smallButton2Url:
{
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_MainMenuPromoData.smallButton2Url.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_sMainMenuPromoData.smallButton2Url.c_str(), -1);
break;
}
case eMainMenuPromoDataProperty::smallButton2ImageIndex:
{
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_MainMenuPromoData.smallButton2ImageIndex);
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_sMainMenuPromoData.smallButton2ImageIndex);
break;
}
}
diff --git a/NorthstarDLL/scriptserverbrowser.cpp b/NorthstarDLL/scriptserverbrowser.cpp
index aa5b0e17..2a366b3f 100644
--- a/NorthstarDLL/scriptserverbrowser.cpp
+++ b/NorthstarDLL/scriptserverbrowser.cpp
@@ -24,21 +24,21 @@ SQRESULT SQ_RequestServerList(void* sqvm)
// bool function NSIsRequestingServerList()
SQRESULT SQ_IsRequestingServerList(void* sqvm)
{
- ClientSq_pushbool(sqvm, g_MasterServerManager->m_scriptRequestingServerList);
+ ClientSq_pushbool(sqvm, g_MasterServerManager->m_bScriptRequestingServerList);
return SQRESULT_NOTNULL;
}
// bool function NSMasterServerConnectionSuccessful()
SQRESULT SQ_MasterServerConnectionSuccessful(void* sqvm)
{
- ClientSq_pushbool(sqvm, g_MasterServerManager->m_successfullyConnected);
+ ClientSq_pushbool(sqvm, g_MasterServerManager->m_bSuccessfullyConnected);
return SQRESULT_NOTNULL;
}
// int function NSGetServerCount()
SQRESULT SQ_GetServerCount(void* sqvm)
{
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_remoteServers.size());
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_vRemoteServers.size());
return SQRESULT_NOTNULL;
}
@@ -47,19 +47,19 @@ SQRESULT SQ_GetServerName(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get name of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].name, -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].name, -1);
return SQRESULT_NOTNULL;
}
@@ -68,19 +68,19 @@ SQRESULT SQ_GetServerDescription(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get description of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].description.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].description.c_str(), -1);
return SQRESULT_NOTNULL;
}
@@ -89,19 +89,19 @@ SQInteger SQ_GetServerMap(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get map of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].map, -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].map, -1);
return SQRESULT_NOTNULL;
}
@@ -110,19 +110,19 @@ SQRESULT SQ_GetServerPlaylist(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get playlist of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].playlist, -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].playlist, -1);
return SQRESULT_NOTNULL;
}
@@ -131,19 +131,19 @@ SQRESULT SQ_GetServerPlayerCount(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get playercount of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].playerCount);
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].playerCount);
return SQRESULT_NOTNULL;
}
@@ -152,19 +152,19 @@ SQRESULT SQ_GetServerMaxPlayerCount(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get max playercount of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].maxPlayers);
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].maxPlayers);
return SQRESULT_NOTNULL;
}
@@ -173,19 +173,19 @@ SQRESULT SQ_GetServerID(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get id of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].id, -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].id, -1);
return SQRESULT_NOTNULL;
}
@@ -194,19 +194,19 @@ SQRESULT SQ_ServerRequiresPassword(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get hasPassword of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushbool(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].requiresPassword);
+ ClientSq_pushbool(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].requiresPassword);
return SQRESULT_NOTNULL;
}
@@ -215,19 +215,19 @@ SQRESULT SQ_GetServerRequiredModsCount(void* sqvm)
{
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get required mods count of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushinteger(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].requiredMods.size());
+ ClientSq_pushinteger(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods.size());
return SQRESULT_NOTNULL;
}
@@ -237,31 +237,31 @@ SQRESULT SQ_GetServerRequiredModName(void* sqvm)
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
SQInteger modIndex = ClientSq_getinteger(sqvm, 2);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get hasPassword of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- if (modIndex >= g_MasterServerManager->m_remoteServers[serverIndex].requiredMods.size())
+ if (modIndex >= g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get required mod name of mod index {} when only {} mod are available",
modIndex,
- g_MasterServerManager->m_remoteServers[serverIndex].requiredMods.size())
+ g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].requiredMods[modIndex].Name.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods[modIndex].Name.c_str(), -1);
return SQRESULT_NOTNULL;
}
@@ -271,31 +271,31 @@ SQRESULT SQ_GetServerRequiredModVersion(void* sqvm)
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
SQInteger modIndex = ClientSq_getinteger(sqvm, 2);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get required mod version of server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
- if (modIndex >= g_MasterServerManager->m_remoteServers[serverIndex].requiredMods.size())
+ if (modIndex >= g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to get required mod version of mod index {} when only {} mod are available",
modIndex,
- g_MasterServerManager->m_remoteServers[serverIndex].requiredMods.size())
+ g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods.size())
.c_str());
return SQRESULT_ERROR;
}
- ClientSq_pushstring(sqvm, g_MasterServerManager->m_remoteServers[serverIndex].requiredMods[modIndex].Version.c_str(), -1);
+ ClientSq_pushstring(sqvm, g_MasterServerManager->m_vRemoteServers[serverIndex].requiredMods[modIndex].Version.c_str(), -1);
return SQRESULT_NOTNULL;
}
@@ -314,14 +314,14 @@ SQRESULT SQ_TryAuthWithServer(void* sqvm)
SQInteger serverIndex = ClientSq_getinteger(sqvm, 1);
const SQChar* password = ClientSq_getstring(sqvm, 2);
- if (serverIndex >= g_MasterServerManager->m_remoteServers.size())
+ if (serverIndex >= g_MasterServerManager->m_vRemoteServers.size())
{
ClientSq_pusherror(
sqvm,
fmt::format(
"Tried to auth with server index {} when only {} servers are available",
serverIndex,
- g_MasterServerManager->m_remoteServers.size())
+ g_MasterServerManager->m_vRemoteServers.size())
.c_str());
return SQRESULT_ERROR;
}
@@ -334,8 +334,8 @@ SQRESULT SQ_TryAuthWithServer(void* sqvm)
// do auth
g_MasterServerManager->AuthenticateWithServer(
g_LocalPlayerUserID,
- g_MasterServerManager->m_ownClientAuthToken,
- g_MasterServerManager->m_remoteServers[serverIndex].id,
+ g_MasterServerManager->m_sOwnClientAuthToken,
+ g_MasterServerManager->m_vRemoteServers[serverIndex].id,
(char*)password);
return SQRESULT_NULL;
@@ -344,14 +344,14 @@ SQRESULT SQ_TryAuthWithServer(void* sqvm)
// bool function NSIsAuthenticatingWithServer()
SQRESULT SQ_IsAuthComplete(void* sqvm)
{
- ClientSq_pushbool(sqvm, g_MasterServerManager->m_scriptAuthenticatingWithGameServer);
+ ClientSq_pushbool(sqvm, g_MasterServerManager->m_bScriptAuthenticatingWithGameServer);
return SQRESULT_NOTNULL;
}
// bool function NSWasAuthSuccessful()
SQRESULT SQ_WasAuthSuccessful(void* sqvm)
{
- ClientSq_pushbool(sqvm, g_MasterServerManager->m_successfullyAuthenticatedWithGameServer);
+ ClientSq_pushbool(sqvm, g_MasterServerManager->m_bSuccessfullyAuthenticatedWithGameServer);
return SQRESULT_NOTNULL;
}
@@ -365,7 +365,7 @@ SQRESULT SQ_GetAuthFailReason(void* sqvm)
// void function NSConnectToAuthedServer()
SQRESULT SQ_ConnectToAuthedServer(void* sqvm)
{
- if (!g_MasterServerManager->m_hasPendingConnectionInfo)
+ if (!g_MasterServerManager->m_bHasPendingConnectionInfo)
{
ClientSq_pusherror(sqvm, fmt::format("Tried to connect to authed server before any pending connection info was available").c_str());
return SQRESULT_ERROR;
@@ -388,7 +388,7 @@ SQRESULT SQ_ConnectToAuthedServer(void* sqvm)
.c_str(),
cmd_source_t::kCommandSrcCode);
- g_MasterServerManager->m_hasPendingConnectionInfo = false;
+ g_MasterServerManager->m_bHasPendingConnectionInfo = false;
return SQRESULT_NULL;
}
@@ -396,7 +396,7 @@ SQRESULT SQ_ConnectToAuthedServer(void* sqvm)
SQRESULT SQ_TryAuthWithLocalServer(void* sqvm)
{
// do auth request
- g_MasterServerManager->AuthenticateWithOwnServer(g_LocalPlayerUserID, g_MasterServerManager->m_ownClientAuthToken);
+ g_MasterServerManager->AuthenticateWithOwnServer(g_LocalPlayerUserID, g_MasterServerManager->m_sOwnClientAuthToken);
return SQRESULT_NULL;
}
diff --git a/NorthstarDLL/serverauthentication.cpp b/NorthstarDLL/serverauthentication.cpp
index 9fc41372..bff19197 100644
--- a/NorthstarDLL/serverauthentication.cpp
+++ b/NorthstarDLL/serverauthentication.cpp
@@ -123,7 +123,7 @@ void ServerAuthenticationManager::StartPlayerAuthServer()
if (!request.has_param("id") || !request.has_param("authToken") || request.body.size() >= 65335 ||
!request.has_param("serverAuthToken") ||
strcmp(
- g_MasterServerManager->m_ownServerAuthToken,
+ g_MasterServerManager->m_sOwnServerAuthToken,
request.get_param_value("serverAuthToken")
.c_str())) // || !resolvedRemoteAddr || ((in_addr**)resolvedRemoteAddr->h_addr_list)[0]->S_un.S_addr !=
// remoteAddr)
--
cgit v1.2.3