mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge pull request #7741 from furo321/translate-racefinish
Use 0.7 translation layer for `Sv_RaceFinish` netmessage.
This commit is contained in:
commit
0f1171a501
|
@ -157,6 +157,21 @@ public:
|
|||
return SendPackMsgOne(&MsgCopy, Flags, ClientID);
|
||||
}
|
||||
|
||||
int SendPackMsgTranslate(const CNetMsg_Sv_RaceFinish *pMsg, int Flags, int ClientID)
|
||||
{
|
||||
if(IsSixup(ClientID))
|
||||
{
|
||||
protocol7::CNetMsg_Sv_RaceFinish Msg7;
|
||||
Msg7.m_ClientID = pMsg->m_ClientID;
|
||||
Msg7.m_Diff = pMsg->m_Diff;
|
||||
Msg7.m_Time = pMsg->m_Time;
|
||||
Msg7.m_RecordPersonal = pMsg->m_RecordPersonal;
|
||||
Msg7.m_RecordServer = pMsg->m_RecordServer;
|
||||
return SendPackMsgOne(&Msg7, Flags, ClientID);
|
||||
}
|
||||
return SendPackMsgOne(pMsg, Flags, ClientID);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
int SendPackMsgOne(const T *pMsg, int Flags, int ClientID)
|
||||
{
|
||||
|
|
|
@ -770,33 +770,19 @@ void CGameTeams::OnFinish(CPlayer *Player, float Time, const char *pTimestamp)
|
|||
Server()->SendPackMsg(&MsgLegacy, MSGFLAG_VITAL, ClientID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CNetMsg_Sv_RaceFinish RaceFinishMsg;
|
||||
RaceFinishMsg.m_ClientID = ClientID;
|
||||
RaceFinishMsg.m_Time = Time * 1000;
|
||||
RaceFinishMsg.m_Diff = 0;
|
||||
if(pData->m_BestTime)
|
||||
{
|
||||
RaceFinishMsg.m_Diff = Diff * 1000 * (Time < pData->m_BestTime ? -1 : 1);
|
||||
}
|
||||
RaceFinishMsg.m_RecordPersonal = (Time < pData->m_BestTime || !pData->m_BestTime);
|
||||
RaceFinishMsg.m_RecordServer = Time < GameServer()->m_pController->m_CurrentRecord;
|
||||
Server()->SendPackMsg(&RaceFinishMsg, MSGFLAG_VITAL | MSGFLAG_NORECORD, -1);
|
||||
}
|
||||
else
|
||||
CNetMsg_Sv_RaceFinish RaceFinishMsg;
|
||||
RaceFinishMsg.m_ClientID = ClientID;
|
||||
RaceFinishMsg.m_Time = Time * 1000;
|
||||
RaceFinishMsg.m_Diff = 0;
|
||||
if(pData->m_BestTime)
|
||||
{
|
||||
protocol7::CNetMsg_Sv_RaceFinish Msg;
|
||||
Msg.m_ClientID = ClientID;
|
||||
Msg.m_Time = Time * 1000;
|
||||
Msg.m_Diff = 0;
|
||||
if(pData->m_BestTime)
|
||||
{
|
||||
Msg.m_Diff = Diff * 1000 * (Time < pData->m_BestTime ? -1 : 1);
|
||||
}
|
||||
Msg.m_RecordPersonal = (Time < pData->m_BestTime || !pData->m_BestTime);
|
||||
Msg.m_RecordServer = Time < GameServer()->m_pController->m_CurrentRecord;
|
||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_NORECORD, -1);
|
||||
RaceFinishMsg.m_Diff = Diff * 1000 * (Time < pData->m_BestTime ? -1 : 1);
|
||||
}
|
||||
RaceFinishMsg.m_RecordPersonal = (Time < pData->m_BestTime || !pData->m_BestTime);
|
||||
RaceFinishMsg.m_RecordServer = Time < GameServer()->m_pController->m_CurrentRecord;
|
||||
Server()->SendPackMsg(&RaceFinishMsg, MSGFLAG_VITAL | MSGFLAG_NORECORD, -1);
|
||||
|
||||
bool CallSaveScore = g_Config.m_SvSaveWorseScores;
|
||||
bool NeedToSendNewPersonalRecord = false;
|
||||
|
|
Loading…
Reference in a new issue