From 25e371fa8ab0d1067393980633089ac20fee8f37 Mon Sep 17 00:00:00 2001 From: def Date: Sat, 31 Dec 2022 15:51:45 +0100 Subject: [PATCH] Don't load best time when already in progress --- src/game/server/gamemodes/DDRace.cpp | 8 ++++++++ src/game/server/score.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/game/server/gamemodes/DDRace.cpp b/src/game/server/gamemodes/DDRace.cpp index fa8f5a260..12f150c27 100644 --- a/src/game/server/gamemodes/DDRace.cpp +++ b/src/game/server/gamemodes/DDRace.cpp @@ -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; } diff --git a/src/game/server/score.cpp b/src/game/server/score.cpp index ecbcce618..e5faa08de 100644 --- a/src/game/server/score.cpp +++ b/src/game/server/score.cpp @@ -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(); ((CGameControllerDDRace *)(m_pGameServer->m_pController))->m_pLoadBestTimeResult = LoadBestTimeResult;