Skip to content
Snippets Groups Projects
Commit aa18d5c3 authored by LJ Sonic's avatar LJ Sonic
Browse files

Move net command sending to a new function

parent 4081dd8e
Branches
Tags
No related merge requests found
......@@ -324,6 +324,28 @@ void SV_CopyNetCommandsToServerPacket(tic_t tic)
}
void CL_SendNetCommands(void)
{
// Send extra data if needed
if (localtextcmd[0])
{
netbuffer->packettype = PT_TEXTCMD;
M_Memcpy(netbuffer->u.textcmd,localtextcmd, localtextcmd[0]+1);
// All extra data have been sent
if (HSendPacket(servernode, true, 0, localtextcmd[0]+1)) // Send can fail...
localtextcmd[0] = 0;
}
// Send extra data if needed for player 2 (splitscreen)
if (localtextcmd2[0])
{
netbuffer->packettype = PT_TEXTCMD2;
M_Memcpy(netbuffer->u.textcmd, localtextcmd2, localtextcmd2[0]+1);
// All extra data have been sent
if (HSendPacket(servernode, true, 0, localtextcmd2[0]+1)) // Send can fail...
localtextcmd2[0] = 0;
}
}
void SendKick(UINT8 playernum, UINT8 msg)
{
UINT8 buf[2];
......
......@@ -58,6 +58,7 @@ size_t TotalTextCmdPerTic(tic_t tic);
void PT_TextCmd(SINT8 node, INT32 netconsole);
void SV_CopyNetCommandsToServerPacket(tic_t tic);
void CL_SendNetCommands(void);
void SendKick(UINT8 playernum, UINT8 msg);
void SendKicksForNode(SINT8 node, UINT8 msg);
......
......@@ -295,27 +295,7 @@ void CL_SendClientCmd(void)
}
if (cl_mode == CL_CONNECTED || dedicated)
{
// Send extra data if needed
if (localtextcmd[0])
{
netbuffer->packettype = PT_TEXTCMD;
M_Memcpy(netbuffer->u.textcmd,localtextcmd, localtextcmd[0]+1);
// All extra data have been sent
if (HSendPacket(servernode, true, 0, localtextcmd[0]+1)) // Send can fail...
localtextcmd[0] = 0;
}
// Send extra data if needed for player 2 (splitscreen)
if (localtextcmd2[0])
{
netbuffer->packettype = PT_TEXTCMD2;
M_Memcpy(netbuffer->u.textcmd, localtextcmd2, localtextcmd2[0]+1);
// All extra data have been sent
if (HSendPacket(servernode, true, 0, localtextcmd2[0]+1)) // Send can fail...
localtextcmd2[0] = 0;
}
}
CL_SendNetCommands();
}
// send the server packet
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment