mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed scoreboard update for slow racers (less hacky) (#765)
* fixed scoreboard update for slow racers (less hacky) * Fix some style issues
This commit is contained in:
parent
37a08e8ef0
commit
727b9f84b6
|
@ -171,6 +171,7 @@ public:
|
||||||
bool m_NinjaJetpack;
|
bool m_NinjaJetpack;
|
||||||
bool m_Afk;
|
bool m_Afk;
|
||||||
int m_KillMe;
|
int m_KillMe;
|
||||||
|
bool m_HasFinishScore;
|
||||||
|
|
||||||
int m_ChatScore;
|
int m_ChatScore;
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,10 @@ void CFileScore::LoadScore(int ClientID)
|
||||||
|
|
||||||
// set score
|
// set score
|
||||||
if (pPlayer)
|
if (pPlayer)
|
||||||
|
{
|
||||||
PlayerData(ClientID)->Set(pPlayer->m_Score, pPlayer->m_aCpTime);
|
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)
|
void CFileScore::SaveTeamScore(int* ClientIDs, unsigned int Size, float Time)
|
||||||
|
|
|
@ -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_BestTime = Time;
|
||||||
pData->PlayerData(pData->m_ClientID)->m_CurrentTime = Time;
|
pData->PlayerData(pData->m_ClientID)->m_CurrentTime = Time;
|
||||||
if(pData->GameServer()->m_apPlayers[pData->m_ClientID])
|
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_Score = -Time;
|
||||||
|
pData->GameServer()->m_apPlayers[pData->m_ClientID]->m_HasFinishScore = true;
|
||||||
|
}
|
||||||
|
|
||||||
char aColumn[8];
|
char aColumn[8];
|
||||||
if(g_Config.m_SvCheckpointSave)
|
if(g_Config.m_SvCheckpointSave)
|
||||||
|
|
|
@ -594,9 +594,8 @@ void CGameTeams::OnFinish(CPlayer* Player)
|
||||||
}
|
}
|
||||||
|
|
||||||
int TTime = 0 - (int)Time;
|
int TTime = 0 - (int)Time;
|
||||||
if (Player->m_Score < TTime)
|
if (Player->m_Score < TTime || !Player->m_HasFinishScore)
|
||||||
Player->m_Score = TTime;
|
Player->m_Score = TTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameTeams::OnCharacterSpawn(int ClientID)
|
void CGameTeams::OnCharacterSpawn(int ClientID)
|
||||||
|
|
Loading…
Reference in a new issue