Don't load best time when already in progress

This commit is contained in:
def 2022-12-31 15:51:45 +01:00
parent 8452d8d028
commit 25e371fa8a
2 changed files with 11 additions and 0 deletions

View file

@ -176,6 +176,14 @@ void CGameControllerDDRace::Tick()
if(m_pLoadBestTimeResult->m_Success)
{
m_CurrentRecord = m_pLoadBestTimeResult->m_CurrentRecord;
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetClientVersion() >= VERSION_DDRACE)
{
GameServer()->SendRecord(i);
}
}
}
m_pLoadBestTimeResult = nullptr;
}

View file

@ -108,6 +108,9 @@ CScore::CScore(CGameContext *pGameServer, CDbConnectionPool *pPool) :
void CScore::LoadBestTime()
{
if(((CGameControllerDDRace *)(m_pGameServer->m_pController))->m_pLoadBestTimeResult)
return; // already in progress
auto LoadBestTimeResult = std::make_shared<CScoreLoadBestTimeResult>();
((CGameControllerDDRace *)(m_pGameServer->m_pController))->m_pLoadBestTimeResult = LoadBestTimeResult;