Added bit size calculation for svc_gameeventlist data

This commit is contained in:
Jordan Cristiano 2015-06-25 00:01:33 -04:00
parent aecc11163f
commit b0e5506384
1 changed files with 19 additions and 0 deletions

View File

@ -8,6 +8,25 @@
using EventDescriptor = NetMsg::SVC_GameEventList::EventDescriptor;
using EventValue = NetMsg::SVC_GameEventList::EventValue;
uint32_t CalculateNumDataBits(const std::vector<EventDescriptor>& eventDescriptors)
{
uint32_t numBits = 0;
for (const EventDescriptor& event : eventDescriptors)
{
numBits += MAX_EVENT_BITS;
// +1 for null char
numBits += (8 * (1 + strlen(event.name)));
// +1 for null bits
numBits += (3 * (1 + event.values.size()));
for (const EventValue& value : event.values)
{
// +1 for null char
numBits += (8 * (1 + strlen(value.name)));
}
}
return numBits;
}
namespace NetHandlers
{
bool SVC_GameEventList_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_GameEventList* data)