diff options
author | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-08-17 19:26:55 +0100 |
---|---|---|
committer | BobTheBob9 <for.oliver.kirkham@gmail.com> | 2022-08-17 19:26:55 +0100 |
commit | e85a3eee190e623e1d6397b4460817170b7bfced (patch) | |
tree | 4fdc57c45832870dfda511027929dba965880d42 /NorthstarDLL/serverpresence.cpp | |
parent | 082f3893215797268d7ac8c1000ebe371f276af7 (diff) | |
download | NorthstarLauncher-e85a3eee190e623e1d6397b4460817170b7bfced.tar.gz NorthstarLauncher-e85a3eee190e623e1d6397b4460817170b7bfced.zip |
implement some more prs
Diffstat (limited to 'NorthstarDLL/serverpresence.cpp')
-rw-r--r-- | NorthstarDLL/serverpresence.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/NorthstarDLL/serverpresence.cpp b/NorthstarDLL/serverpresence.cpp index 4e9c5c28..cfc1c213 100644 --- a/NorthstarDLL/serverpresence.cpp +++ b/NorthstarDLL/serverpresence.cpp @@ -117,6 +117,7 @@ void ServerPresenceManager::CreatePresence() m_ServerPresence.m_bIsSingleplayerServer = false; m_bHasPresence = true; + m_bFirstPresenceUpdate = true; // code that's calling this should set up the reset fields at this point } @@ -142,6 +143,16 @@ void ServerPresenceManager::RunFrame(double flCurrentTime) if ((flCurrentTime - m_flLastPresenceUpdate) * 1000 < Cvar_ns_server_presence_update_rate->GetFloat()) return; + // is this the first frame we're updating this presence? + if (m_bFirstPresenceUpdate) + { + // let reporters setup/clear any state + for (ServerPresenceReporter* reporter : m_vPresenceReporters) + reporter->CreatePresence(&m_ServerPresence); + + m_bFirstPresenceUpdate = false; + } + m_flLastPresenceUpdate = flCurrentTime; for (ServerPresenceReporter* reporter : m_vPresenceReporters) @@ -178,7 +189,7 @@ void ServerPresenceManager::SetPassword(const char* pPassword) strncpy_s(m_ServerPresence.m_Password, sizeof(m_ServerPresence.m_Password), pPassword, sizeof(m_ServerPresence.m_Password) - 1); } -void ServerPresenceManager::SetMap(const char* pMapName, bool isInitialising = false) +void ServerPresenceManager::SetMap(const char* pMapName, bool isInitialising) { // if the server is initialising (i.e. this is first map) on sp, set the server to sp if (isInitialising) |