2015-05-15 03:36:57 +02:00
|
|
|
|
|
|
|
#include "svc_tempentities.h"
|
2015-06-25 05:59:39 +02:00
|
|
|
#include "base/bitfile.h"
|
2016-04-28 04:31:33 +02:00
|
|
|
#include "game/sourcecontext.h"
|
2015-05-15 03:36:57 +02:00
|
|
|
#include "netcontants.h"
|
|
|
|
#include "netmath.h"
|
|
|
|
|
|
|
|
namespace NetHandlers
|
|
|
|
{
|
2015-06-19 02:23:26 +02:00
|
|
|
bool SVC_TempEntities_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_TempEntities* data)
|
2015-05-15 03:36:57 +02:00
|
|
|
{
|
|
|
|
data->numEntries = bitbuf.ReadUBitLong(EVENT_INDEX_BITS);
|
2015-05-15 07:15:11 +02:00
|
|
|
if (context.protocol > 23)
|
|
|
|
{
|
|
|
|
data->dataLengthInBits = bitbuf.ReadVarInt32();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
data->dataLengthInBits = bitbuf.ReadUBitLong(NET_MAX_PAYLOAD_BITS_OLD);
|
|
|
|
}
|
2015-05-15 03:36:57 +02:00
|
|
|
data->data.reset(new uint8_t[math::BitsToBytes(data->dataLengthInBits)]);
|
|
|
|
bitbuf.ReadBits(data->data.get(), data->dataLengthInBits);
|
|
|
|
return !bitbuf.IsOverflowed();
|
|
|
|
}
|
|
|
|
}
|