From 2423e35fd292fc7eb9e19d3580433086c071fb2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 14 Apr 2024 22:08:57 +0200 Subject: [PATCH] Fix incorrect score kind in demos depending on last server Clear current server info when playing demos to ensure that the score kind (points, time) is detected correctly. Previously, when playing a demo with points score kind and `cl_demo_assume_race 0`, the score was not shown as points when the last server that the client connected to had a race gametype. Move the implementation for `cl_demo_assume_race` together with the rest of the demo server info initialization in the `CClient::DemoPlayer_Play` function. --- src/engine/client/client.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 79a19a65b..8e1b5af31 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -658,9 +658,6 @@ int CClient::GetCurrentRaceTime() void CClient::GetServerInfo(CServerInfo *pServerInfo) const { mem_copy(pServerInfo, &m_CurrentServerInfo, sizeof(m_CurrentServerInfo)); - - if(m_DemoPlayer.IsPlaying() && g_Config.m_ClDemoAssumeRace) - str_copy(pServerInfo->m_aGameType, "DDraceNetwork"); } void CClient::ServerInfoRequest() @@ -3564,10 +3561,15 @@ const char *CClient::DemoPlayer_Play(const char *pFilename, int StorageType) } } - // setup current info + // setup current server info + mem_zero(&m_CurrentServerInfo, sizeof(m_CurrentServerInfo)); str_copy(m_CurrentServerInfo.m_aMap, pMapInfo->m_aName); m_CurrentServerInfo.m_MapCrc = pMapInfo->m_Crc; m_CurrentServerInfo.m_MapSize = pMapInfo->m_Size; + if(g_Config.m_ClDemoAssumeRace) + { + str_copy(m_CurrentServerInfo.m_aGameType, "DDraceNetwork"); + } GameClient()->OnConnected();