diff options
Diffstat (limited to 'NorthstarDedicatedTest/dedicated.cpp')
-rw-r--r-- | NorthstarDedicatedTest/dedicated.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/NorthstarDedicatedTest/dedicated.cpp b/NorthstarDedicatedTest/dedicated.cpp index 1555eaaf..e140281a 100644 --- a/NorthstarDedicatedTest/dedicated.cpp +++ b/NorthstarDedicatedTest/dedicated.cpp @@ -58,17 +58,24 @@ void RunServer(CDedicatedExports* dedicated) // note: we no longer manually set map and hoststate to start server in g_pHostState, we just use +map which seems to initialise stuff better // main loop + double frameTitle = 0; while (g_pEngine->m_nQuitting == EngineQuitState::QUIT_NOTQUITTING) { double frameStart = Plat_FloatTime(); g_pEngine->Frame(); - // this way of getting playercount/maxplayers honestly really sucks, but not got any other methods of doing it rn - const char* maxPlayers = GetCurrentPlaylistVar("max_players", false); - if (!maxPlayers) - maxPlayers = "6"; + // only update the title after at least 500ms since the last update + if ((frameStart - frameTitle) > 0.5) { + frameTitle = frameStart; + + // this way of getting playercount/maxplayers honestly really sucks, but not got any other methods of doing it rn + const char* maxPlayers = GetCurrentPlaylistVar("max_players", false); + if (!maxPlayers) + maxPlayers = "6"; + + SetConsoleTitleA(fmt::format("{} - {} {}/{} players ({})", g_MasterServerManager->ns_auth_srvName, g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), maxPlayers, GetCurrentPlaylistName()).c_str()); + } - SetConsoleTitleA(fmt::format("{} - {} {}/{} players ({})", g_MasterServerManager->ns_auth_srvName, g_pHostState->m_levelName, g_ServerAuthenticationManager->m_additionalPlayerData.size(), maxPlayers, GetCurrentPlaylistName()).c_str()); std::this_thread::sleep_for(std::chrono::duration<double, std::ratio<1>>(Cvar_base_tickinterval_mp->m_fValue - fmin(Plat_FloatTime() - frameStart, 0.25))); } } |