From 727b9f84b6262bb7890e9bd47ee35945ee7a76f5 Mon Sep 17 00:00:00 2001 From: ChillerDragon Date: Wed, 5 Jul 2017 23:01:57 +0200 Subject: [PATCH] fixed scoreboard update for slow racers (less hacky) (#765) * fixed scoreboard update for slow racers (less hacky) * Fix some style issues --- src/game/server/player.h | 1 + src/game/server/score/file_score.cpp | 3 +++ src/game/server/score/sql_score.cpp | 3 +++ src/game/server/teams.cpp | 3 +-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/game/server/player.h b/src/game/server/player.h index 2708356fe..5cd1bef41 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -171,6 +171,7 @@ public: bool m_NinjaJetpack; bool m_Afk; int m_KillMe; + bool m_HasFinishScore; int m_ChatScore; diff --git a/src/game/server/score/file_score.cpp b/src/game/server/score/file_score.cpp index 6db15bf4d..2859054e0 100644 --- a/src/game/server/score/file_score.cpp +++ b/src/game/server/score/file_score.cpp @@ -219,7 +219,10 @@ void CFileScore::LoadScore(int ClientID) // set score if (pPlayer) + { PlayerData(ClientID)->Set(pPlayer->m_Score, pPlayer->m_aCpTime); + GameServer()->m_apPlayers[ClientID]->m_HasFinishScore = true; + } } void CFileScore::SaveTeamScore(int* ClientIDs, unsigned int Size, float Time) diff --git a/src/game/server/score/sql_score.cpp b/src/game/server/score/sql_score.cpp index bc6ab73d2..376467e9e 100644 --- a/src/game/server/score/sql_score.cpp +++ b/src/game/server/score/sql_score.cpp @@ -236,7 +236,10 @@ bool CSqlScore::LoadScoreThread(CSqlServer* pSqlServer, const CSqlData *pGameDat pData->PlayerData(pData->m_ClientID)->m_BestTime = Time; pData->PlayerData(pData->m_ClientID)->m_CurrentTime = Time; if(pData->GameServer()->m_apPlayers[pData->m_ClientID]) + { pData->GameServer()->m_apPlayers[pData->m_ClientID]->m_Score = -Time; + pData->GameServer()->m_apPlayers[pData->m_ClientID]->m_HasFinishScore = true; + } char aColumn[8]; if(g_Config.m_SvCheckpointSave) diff --git a/src/game/server/teams.cpp b/src/game/server/teams.cpp index 70f06afe4..1d2473dee 100644 --- a/src/game/server/teams.cpp +++ b/src/game/server/teams.cpp @@ -594,9 +594,8 @@ void CGameTeams::OnFinish(CPlayer* Player) } int TTime = 0 - (int)Time; - if (Player->m_Score < TTime) + if (Player->m_Score < TTime || !Player->m_HasFinishScore) Player->m_Score = TTime; - } void CGameTeams::OnCharacterSpawn(int ClientID)