2015-05-15 03:36:57 +02:00
|
|
|
|
|
|
|
#include "svc_sendtable.h"
|
2015-06-14 22:15:08 +02:00
|
|
|
#include "sourcesdk/bitbuf.h"
|
2015-05-15 03:36:57 +02:00
|
|
|
#include "netmath.h"
|
|
|
|
|
|
|
|
namespace NetHandlers
|
|
|
|
{
|
|
|
|
bool SVC_SendTable_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_SendTable* data)
|
|
|
|
{
|
|
|
|
data->needsDecoder = bitbuf.ReadOneBit() != 0;
|
|
|
|
data->dataLengthInBits = bitbuf.ReadShort();
|
|
|
|
data->data.reset(new uint8_t[math::BitsToBytes(data->dataLengthInBits)]);
|
|
|
|
bitbuf.ReadBits(data->data.get(), data->dataLengthInBits);
|
|
|
|
return !bitbuf.IsOverflowed();
|
|
|
|
}
|
|
|
|
|
2015-05-15 08:49:51 +02:00
|
|
|
bool SVC_SendTable_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_SendTable* data)
|
2015-05-15 03:36:57 +02:00
|
|
|
{
|
|
|
|
bitbuf.WriteOneBit(data->needsDecoder);
|
|
|
|
bitbuf.WriteShort(data->dataLengthInBits);
|
|
|
|
bitbuf.WriteBits(data->data.get(), data->dataLengthInBits);
|
|
|
|
return !bitbuf.IsOverflowed();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SVC_SendTable_JsonRead_Internal(JsonRead& jsonbuf, SourceGameContext& context, NetMsg::SVC_SendTable* data)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-05-15 08:49:51 +02:00
|
|
|
bool SVC_SendTable_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_SendTable* data)
|
2015-05-15 03:36:57 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SVC_SendTable_ToString_Internal(std::ostringstream& out, NetMsg::SVC_SendTable* data)
|
|
|
|
{
|
|
|
|
out << "svc_SendTable: needs Decoder " << (data->needsDecoder ? "yes" : "no")
|
|
|
|
<< ",bytes " << math::BitsToBytes(data->dataLengthInBits);
|
|
|
|
}
|
|
|
|
}
|