diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 8d59e5dbe..74f457fe0 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -1632,7 +1632,7 @@ void CHud::OnMessage(int MsgType, void *pRawMsg) m_FinishTime = pMsg->m_Finish != 0; - if(pMsg->m_Check) + if(!m_FinishTime) { m_CheckpointDiff = (float)pMsg->m_Check / 100; m_CheckpointTick = Client()->GameTick(g_Config.m_ClDummy); diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 981e593d1..10d199c03 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1341,31 +1341,26 @@ bool CCharacter::IsSwitchActiveCb(int Number, void *pUser) return !aSwitchers.empty() && pThis->Team() != TEAM_SUPER && aSwitchers[Number].m_Status[pThis->Team()]; } -void CCharacter::SetTimeCheckpoint(int TimeCpNumber) +void CCharacter::SetTimeCheckpoint(int TimeCheckpoint) { - if(TimeCpNumber != -1 && m_DDRaceState == DDRACE_STARTED && TimeCpNumber > m_CpActive) + if(TimeCheckpoint != -1 && m_DDRaceState == DDRACE_STARTED && TimeCheckpoint > m_CpActive) { - m_CpActive = TimeCpNumber; - m_CpCurrent[TimeCpNumber] = m_Time; + m_CpActive = TimeCheckpoint; + m_CpCurrent[TimeCheckpoint] = m_Time; m_CpTick = Server()->Tick() + Server()->TickSpeed() * 2; if(m_pPlayer->GetClientVersion() >= VERSION_DDRACE) { CPlayerData *pData = GameServer()->Score()->PlayerData(m_pPlayer->GetCID()); - CNetMsg_Sv_DDRaceTime Msg; - Msg.m_Time = (int)m_Time; - Msg.m_Check = 0; - Msg.m_Finish = 0; - - if(m_CpActive != -1 && m_CpTick > Server()->Tick()) + if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0 && m_CpActive != -1) { - if(pData->m_BestTime && pData->m_aBestCpTime[m_CpActive] != 0) - { - float Diff = (m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive]) * 100; - Msg.m_Check = (int)Diff; - } + CNetMsg_Sv_DDRaceTime Msg; + Msg.m_Time = (int)(m_Time * 100.0f); + Msg.m_Check = 0; + Msg.m_Finish = 0; + float Diff = (m_CpCurrent[m_CpActive] - pData->m_aBestCpTime[m_CpActive]) * 100; + Msg.m_Check = (int)Diff; + Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID()); } - - Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, m_pPlayer->GetCID()); } } } @@ -1386,9 +1381,9 @@ void CCharacter::HandleTiles(int Index) } SetTimeCheckpoint(Collision()->IsTimeCheckpoint(MapIndex)); SetTimeCheckpoint(Collision()->IsFTimeCheckpoint(MapIndex)); - int tcp = Collision()->IsTeleCheckpoint(MapIndex); - if(tcp) - m_TeleCheckpoint = tcp; + int TeleCheckpoint = Collision()->IsTeleCheckpoint(MapIndex); + if(TeleCheckpoint) + m_TeleCheckpoint = TeleCheckpoint; GameServer()->m_pController->HandleCharacterTiles(this, Index); diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index 443294869..c829d6c5d 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -143,7 +143,7 @@ private: void SnapCharacter(int SnappingClient, int ID); static bool IsSwitchActiveCb(int Number, void *pUser); - void SetTimeCheckpoint(int TimeCpNumber); + void SetTimeCheckpoint(int TimeCheckpoint); void HandleTiles(int Index); float m_Time; int m_LastBroadcast;