-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnetmessages.cpp
More file actions
27 lines (21 loc) · 787 Bytes
/
netmessages.cpp
File metadata and controls
27 lines (21 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "netmessages.h"
#include <tier1/strtools.h>
static char s_text[1024];
bool SVC_VoiceData::WriteToBuffer( bf_write &buffer ) {
buffer.WriteUBitLong( GetType(), NETMSG_TYPE_BITS );
buffer.WriteByte( m_nFromClient );
//buffer.WriteByte( m_bProximity );
buffer.WriteWord( m_nLength );
return buffer.WriteBits( m_DataOut, m_nLength );
}
bool SVC_VoiceData::ReadFromBuffer( bf_read &buffer ) {
m_nFromClient = buffer.ReadByte();
//m_bProximity = !!buffer.ReadByte();
m_nLength = buffer.ReadWord();
m_DataIn = buffer;
return buffer.SeekRelative( m_nLength );
}
const char *SVC_VoiceData::ToString(void) const {
Q_snprintf(s_text, sizeof(s_text), "%s: client %i, bytes %i", GetName(), m_nFromClient, Bits2Bytes(m_nLength) );
return s_text;
}