Reverse Translation for DDRace64

This commit is contained in:
def 2013-12-31 18:25:40 +01:00
parent be213e72d3
commit 08eb38230f

View file

@ -1042,6 +1042,9 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
} }
int KickID = str_toint(pMsg->m_Value); int KickID = str_toint(pMsg->m_Value);
if (!Server()->ReverseTranslate(KickID, ClientID))
return;
if(KickID < 0 || KickID >= MAX_CLIENTS || !m_apPlayers[KickID]) if(KickID < 0 || KickID >= MAX_CLIENTS || !m_apPlayers[KickID])
{ {
SendChatTarget(ClientID, "Invalid client id to kick"); SendChatTarget(ClientID, "Invalid client id to kick");
@ -1093,6 +1096,9 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
} }
int SpectateID = str_toint(pMsg->m_Value); int SpectateID = str_toint(pMsg->m_Value);
if (!Server()->ReverseTranslate(SpectateID, ClientID))
return;
if(SpectateID < 0 || SpectateID >= MAX_CLIENTS || !m_apPlayers[SpectateID] || m_apPlayers[SpectateID]->GetTeam() == TEAM_SPECTATORS) if(SpectateID < 0 || SpectateID >= MAX_CLIENTS || !m_apPlayers[SpectateID] || m_apPlayers[SpectateID]->GetTeam() == TEAM_SPECTATORS)
{ {
SendChatTarget(ClientID, "Invalid client id to move"); SendChatTarget(ClientID, "Invalid client id to move");
@ -1239,6 +1245,10 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, -1); Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, -1);
} }
} }
else if (MsgID == NETMSGTYPE_CL_ISDDRACE64)
{
Server()->SetCustClt(ClientID);
}
else if (MsgID == NETMSGTYPE_CL_SHOWOTHERS) else if (MsgID == NETMSGTYPE_CL_SHOWOTHERS)
{ {
if(g_Config.m_SvShowOthers && !g_Config.m_SvShowOthersDefault) if(g_Config.m_SvShowOthers && !g_Config.m_SvShowOthersDefault)
@ -1251,6 +1261,10 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
{ {
CNetMsg_Cl_SetSpectatorMode *pMsg = (CNetMsg_Cl_SetSpectatorMode *)pRawMsg; CNetMsg_Cl_SetSpectatorMode *pMsg = (CNetMsg_Cl_SetSpectatorMode *)pRawMsg;
if(pMsg->m_SpectatorID != SPEC_FREEVIEW)
if (!Server()->ReverseTranslate(pMsg->m_SpectatorID, ClientID))
return;
if((pPlayer->GetTeam() != TEAM_SPECTATORS && !pPlayer->m_Paused) || pPlayer->m_SpectatorID == pMsg->m_SpectatorID || ClientID == pMsg->m_SpectatorID || if((pPlayer->GetTeam() != TEAM_SPECTATORS && !pPlayer->m_Paused) || pPlayer->m_SpectatorID == pMsg->m_SpectatorID || ClientID == pMsg->m_SpectatorID ||
(g_Config.m_SvSpamprotection && pPlayer->m_LastSetSpectatorMode && pPlayer->m_LastSetSpectatorMode+Server()->TickSpeed() > Server()->Tick())) (g_Config.m_SvSpamprotection && pPlayer->m_LastSetSpectatorMode && pPlayer->m_LastSetSpectatorMode+Server()->TickSpeed() > Server()->Tick()))
return; return;