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.
This commit is contained in:
Robert Müller 2024-04-14 22:08:57 +02:00
parent 06f1db98e6
commit 2423e35fd2

View file

@ -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();