mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
More fixes to KILLMSGTEAM
This commit is contained in:
parent
6fc27bea8c
commit
04c5c6a5d6
|
@ -628,6 +628,20 @@ void CGhost::OnMessage(int MsgType, void *pRawMsg)
|
|||
m_LastDeathTick = Client()->GameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
}
|
||||
else if(MsgType == NETMSGTYPE_SV_KILLMSGTEAM)
|
||||
{
|
||||
CNetMsg_Sv_KillMsgTeam *pMsg = (CNetMsg_Sv_KillMsgTeam *)pRawMsg;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(m_pClient->m_Teams.Team(i) == pMsg->m_Team && i == m_pClient->m_Snap.m_LocalClientID)
|
||||
{
|
||||
if(m_Recording)
|
||||
StopRecord();
|
||||
StopRender();
|
||||
m_LastDeathTick = Client()->GameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(MsgType == NETMSGTYPE_SV_CHAT)
|
||||
{
|
||||
CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg;
|
||||
|
|
|
@ -135,6 +135,15 @@ void CRaceDemo::OnMessage(int MsgType, void *pRawMsg)
|
|||
if(pMsg->m_Victim == m_pClient->m_Snap.m_LocalClientID && Client()->RaceRecord_IsRecording())
|
||||
StopRecord(m_Time);
|
||||
}
|
||||
else if(MsgType == NETMSGTYPE_SV_KILLMSGTEAM)
|
||||
{
|
||||
CNetMsg_Sv_KillMsgTeam *pMsg = (CNetMsg_Sv_KillMsgTeam *)pRawMsg;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(m_pClient->m_Teams.Team(i) == pMsg->m_Team && i == m_pClient->m_Snap.m_LocalClientID && Client()->RaceRecord_IsRecording())
|
||||
StopRecord(m_Time);
|
||||
}
|
||||
}
|
||||
else if(MsgType == NETMSGTYPE_SV_CHAT)
|
||||
{
|
||||
CNetMsg_Sv_Chat *pMsg = (CNetMsg_Sv_Chat *)pRawMsg;
|
||||
|
|
|
@ -934,6 +934,30 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dumm
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(MsgId == NETMSGTYPE_SV_KILLMSGTEAM)
|
||||
{
|
||||
CNetMsg_Sv_KillMsgTeam *pMsg = (CNetMsg_Sv_KillMsgTeam *)pRawMsg;
|
||||
|
||||
// reset prediction
|
||||
std::vector<std::pair<int, int>> vStrongWeakSorted;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(m_Teams.Team(i) == pMsg->m_Team)
|
||||
{
|
||||
if(CCharacter *pChar = m_GameWorld.GetCharacterByID(i))
|
||||
{
|
||||
pChar->ResetPrediction();
|
||||
vStrongWeakSorted.emplace_back(i, pMsg->m_First == i ? MAX_CLIENTS : pChar ? pChar->GetStrongWeakID() : 0);
|
||||
}
|
||||
m_GameWorld.ReleaseHooked(i);
|
||||
}
|
||||
}
|
||||
std::stable_sort(vStrongWeakSorted.begin(), vStrongWeakSorted.end(), [](auto &Left, auto &Right) { return Left.second > Right.second; });
|
||||
for(auto ID : vStrongWeakSorted)
|
||||
{
|
||||
m_CharOrder.GiveWeak(ID.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameClient::OnStateChange(int NewState, int OldState)
|
||||
|
|
Loading…
Reference in a new issue