Merge pull request #770 from heinrich5991/pr_fix_events_uuid

Fix unpacking of net events
This commit is contained in:
Dennis Felsing 2017-05-27 16:21:37 +02:00 committed by GitHub
commit ca9cca4c94
2 changed files with 5 additions and 4 deletions

View file

@ -194,19 +194,20 @@ if gen_network_source:
lines += ["const char *CNetObjHandler::ms_apObjNames[] = {"]
lines += ['\t"invalid",']
lines += ['\t"%s",' % o.name for o in network.Objects]
lines += ['\t"%s",' % o.name for o in network.Objects if o.ex is None]
lines += ['\t""', "};", ""]
lines += ["int CNetObjHandler::ms_aObjSizes[] = {"]
lines += ['\t0,']
lines += ['\tsizeof(%s),' % o.struct_name for o in network.Objects]
lines += ['\tsizeof(%s),' % o.struct_name for o in network.Objects if o.ex is None]
lines += ['\t0', "};", ""]
lines += ['const char *CNetObjHandler::ms_apMsgNames[] = {']
lines += ['\t"invalid",']
for msg in network.Messages:
lines += ['\t"%s",' % msg.name]
if msg.ex is None:
lines += ['\t"%s",' % msg.name]
lines += ['\t""']
lines += ['};']
lines += ['']

View file

@ -359,7 +359,7 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
Type = *pData++;
ID = *pData++;
if ((unsigned int)Type < sizeof(m_aItemSizes) && m_aItemSizes[Type])
if ((unsigned int)Type < sizeof(m_aItemSizes) / sizeof(m_aItemSizes[0]) && m_aItemSizes[Type])
ItemSize = m_aItemSizes[Type];
else
{