Allow joining TEAM_SPECTATOR

This commit is contained in:
Learath 2020-06-16 18:19:53 +03:00
parent 9f71478099
commit 32fb6718dd
3 changed files with 26 additions and 1 deletions

View file

@ -562,6 +562,7 @@ int *CSnapshotBuilder::GetItemData(int Key)
int CSnapshotBuilder::Finish(void *SpnapData) int CSnapshotBuilder::Finish(void *SpnapData)
{ {
//dbg_msg("snap", "---------------------------");
// flattern and make the snapshot // flattern and make the snapshot
CSnapshot *pSnap = (CSnapshot *)SpnapData; CSnapshot *pSnap = (CSnapshot *)SpnapData;
int OffsetSize = sizeof(int)*m_NumItems; int OffsetSize = sizeof(int)*m_NumItems;
@ -628,14 +629,18 @@ void *CSnapshotBuilder::NewItem(int Type, int ID, int Size)
if(m_Sixup) if(m_Sixup)
{ {
//dbg_msg("snap", "intype=%d", Type);
if(Type >= 0) if(Type >= 0)
Type = Obj_SixToSeven(Type); Type = Obj_SixToSeven(Type);
else else
Type *= -1; Type *= -1;
//dbg_msg("snap", "outtype=%d", Type);
if(Type < 0) return pObj; if(Type < 0) return pObj;
} }
//dbg_msg("snap", "adding type='%d' id='%d' size='%d'", Type, ID, Size);
mem_zero(pObj, sizeof(CSnapshotItem) + Size); mem_zero(pObj, sizeof(CSnapshotItem) + Size);
pObj->m_TypeAndID = (Type<<16)|ID; pObj->m_TypeAndID = (Type<<16)|ID;
m_aOffsets[m_NumItems] = m_DataSize; m_aOffsets[m_NumItems] = m_DataSize;

View file

@ -1223,6 +1223,19 @@ void CGameContext::OnClientConnected(int ClientID)
Msg.m_pMessage = g_Config.m_SvMotd; Msg.m_pMessage = g_Config.m_SvMotd;
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID); 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(); Server()->ExpireServerInfo();
} }
@ -1396,6 +1409,13 @@ void *CGameContext::PreProcessMsg(int *MsgID, CUnpacker *pUnpacker, int ClientID
else else
pMsg->m_SpectatorID = SPEC_FREEVIEW; // Probably not needed 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); *MsgID = Msg_SevenToSix(*MsgID);