diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 20:45:00 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-09 20:45:00 +0100 |
commit | 44034d69a54e2ef9e56cac06abf80a10fd3dcfcf (patch) | |
tree | aa137a8154afe9fdc7639fd53cc1dabecdf5b903 /NorthstarDedicatedTest/masterserver.cpp | |
parent | 5ce8343bcced9e92ab2b3c1b80382cffa0281629 (diff) | |
download | NorthstarLauncher-44034d69a54e2ef9e56cac06abf80a10fd3dcfcf.tar.gz NorthstarLauncher-44034d69a54e2ef9e56cac06abf80a10fd3dcfcf.zip |
use cvar change callbacks for unescaping ns_server_name and ns_server_desc
Diffstat (limited to 'NorthstarDedicatedTest/masterserver.cpp')
-rw-r--r-- | NorthstarDedicatedTest/masterserver.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index 1ef53c7d..96a07030 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -110,12 +110,6 @@ std::string unescape_unicode(const std::string& str) return result; } -void UpdateServerInfoFromUnicodeToUTF8() -{ - g_MasterServerManager->m_sUnicodeServerName = unescape_unicode(Cvar_ns_server_name->GetString()); - g_MasterServerManager->m_sUnicodeServerDesc = unescape_unicode(Cvar_ns_server_desc->GetString()); -} - RemoteServerInfo::RemoteServerInfo( const char* newId, const char* newName, @@ -1240,8 +1234,6 @@ void CHostState__State_NewGameHook(CHostState* hostState) // Copy new server name cvar to source Cvar_hostname->SetValue(Cvar_ns_server_name->GetString()); - // This calls the function that converts unicode strings from servername and serverdesc to UTF-8 - UpdateServerInfoFromUnicodeToUTF8(); g_MasterServerManager->AddSelfToServerList( Cvar_hostport->GetInt(), @@ -1309,8 +1301,12 @@ ON_DLL_LOAD_RELIESON("engine.dll", MasterServer, ConCommand, [](HMODULE baseAddr // unfortunately lib doesn't let us specify a port and still have https work // Cvar_ns_masterserver_port = new ConVar("ns_masterserver_port", "8080", FCVAR_NONE, ""); - Cvar_ns_server_name = new ConVar("ns_server_name", "Unnamed Northstar Server", FCVAR_GAMEDLL, ""); - Cvar_ns_server_desc = new ConVar("ns_server_desc", "Default server description", FCVAR_GAMEDLL, ""); + Cvar_ns_server_name = new ConVar("ns_server_name", "Unnamed Northstar Server", FCVAR_GAMEDLL, "", false, 0, false, 0, [](ConVar* cvar, const char* pOldValue, float flOldValue) { + g_MasterServerManager->m_sUnicodeServerName = unescape_unicode(Cvar_ns_server_name->GetString()); + }); + Cvar_ns_server_desc = new ConVar("ns_server_desc", "Default server description", FCVAR_GAMEDLL, "", false, 0, false, 0, [](ConVar* cvar, const char* pOldValue, float flOldValue) { + g_MasterServerManager->m_sUnicodeServerName = unescape_unicode(Cvar_ns_server_desc->GetString()); + }); Cvar_ns_server_password = new ConVar("ns_server_password", "", FCVAR_GAMEDLL, ""); Cvar_ns_report_server_to_masterserver = new ConVar("ns_report_server_to_masterserver", "1", FCVAR_GAMEDLL, ""); Cvar_ns_report_sp_server_to_masterserver = new ConVar("ns_report_sp_server_to_masterserver", "0", FCVAR_GAMEDLL, ""); |