mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Allow joining TEAM_SPECTATOR
This commit is contained in:
parent
9f71478099
commit
32fb6718dd
|
@ -562,6 +562,7 @@ int *CSnapshotBuilder::GetItemData(int Key)
|
|||
|
||||
int CSnapshotBuilder::Finish(void *SpnapData)
|
||||
{
|
||||
//dbg_msg("snap", "---------------------------");
|
||||
// flattern and make the snapshot
|
||||
CSnapshot *pSnap = (CSnapshot *)SpnapData;
|
||||
int OffsetSize = sizeof(int)*m_NumItems;
|
||||
|
@ -628,14 +629,18 @@ void *CSnapshotBuilder::NewItem(int Type, int ID, int Size)
|
|||
|
||||
if(m_Sixup)
|
||||
{
|
||||
//dbg_msg("snap", "intype=%d", Type);
|
||||
if(Type >= 0)
|
||||
Type = Obj_SixToSeven(Type);
|
||||
else
|
||||
Type *= -1;
|
||||
//dbg_msg("snap", "outtype=%d", Type);
|
||||
|
||||
if(Type < 0) return pObj;
|
||||
}
|
||||
|
||||
//dbg_msg("snap", "adding type='%d' id='%d' size='%d'", Type, ID, Size);
|
||||
|
||||
mem_zero(pObj, sizeof(CSnapshotItem) + Size);
|
||||
pObj->m_TypeAndID = (Type<<16)|ID;
|
||||
m_aOffsets[m_NumItems] = m_DataSize;
|
||||
|
|
|
@ -1366,7 +1366,7 @@ void CGameClient::OnNewSnapshot()
|
|||
if(m_Snap.m_LocalClientID >= 0)
|
||||
{
|
||||
m_LocalIDs[g_Config.m_ClDummy] = m_Snap.m_LocalClientID;
|
||||
|
||||
|
||||
CSnapState::CCharacterInfo *c = &m_Snap.m_aCharacters[m_Snap.m_LocalClientID];
|
||||
if(c->m_Active)
|
||||
{
|
||||
|
|
|
@ -1223,6 +1223,19 @@ void CGameContext::OnClientConnected(int ClientID)
|
|||
Msg.m_pMessage = g_Config.m_SvMotd;
|
||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID);
|
||||
|
||||
//send sixup settings
|
||||
if(Server()->IsSixup(ClientID))
|
||||
{
|
||||
protocol7::CNetMsg_Sv_ServerSettings Msg;
|
||||
Msg.m_KickVote = g_Config.m_SvVoteKick;
|
||||
Msg.m_KickMin = g_Config.m_SvVoteKickMin;
|
||||
Msg.m_SpecVote = g_Config.m_SvVoteSpectate;
|
||||
Msg.m_TeamLock = 0;
|
||||
Msg.m_TeamBalance = 0;
|
||||
Msg.m_PlayerSlots = g_Config.m_SvMaxClients - g_Config.m_SvSpectatorSlots;
|
||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL|MSGFLAG_NORECORD, ClientID);
|
||||
}
|
||||
|
||||
Server()->ExpireServerInfo();
|
||||
}
|
||||
|
||||
|
@ -1396,6 +1409,13 @@ void *CGameContext::PreProcessMsg(int *MsgID, CUnpacker *pUnpacker, int ClientID
|
|||
else
|
||||
pMsg->m_SpectatorID = SPEC_FREEVIEW; // Probably not needed
|
||||
}
|
||||
else if(*MsgID == protocol7::NETMSGTYPE_CL_SETTEAM)
|
||||
{
|
||||
protocol7::CNetMsg_Cl_SetTeam *pMsg7 = (protocol7::CNetMsg_Cl_SetTeam *)pRawMsg;
|
||||
::CNetMsg_Cl_SetTeam *pMsg = (::CNetMsg_Cl_SetTeam *)s_aRawMsg;
|
||||
|
||||
pMsg->m_Team = pMsg7->m_Team;
|
||||
}
|
||||
|
||||
*MsgID = Msg_SevenToSix(*MsgID);
|
||||
|
||||
|
|
Loading…
Reference in a new issue