mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Refactor CSnapshotBuilder::Finish
using TotalSize
and OffsetSize
This commit is contained in:
parent
3863d41623
commit
4c397e479a
|
@ -594,14 +594,13 @@ int *CSnapshotBuilder::GetItemData(int Key)
|
||||||
|
|
||||||
int CSnapshotBuilder::Finish(void *pSnapData)
|
int CSnapshotBuilder::Finish(void *pSnapData)
|
||||||
{
|
{
|
||||||
// flattern and make the snapshot
|
// flatten and make the snapshot
|
||||||
CSnapshot *pSnap = (CSnapshot *)pSnapData;
|
CSnapshot *pSnap = (CSnapshot *)pSnapData;
|
||||||
int OffsetSize = sizeof(int) * m_NumItems;
|
|
||||||
pSnap->m_DataSize = m_DataSize;
|
pSnap->m_DataSize = m_DataSize;
|
||||||
pSnap->m_NumItems = m_NumItems;
|
pSnap->m_NumItems = m_NumItems;
|
||||||
mem_copy(pSnap->Offsets(), m_aOffsets, OffsetSize);
|
mem_copy(pSnap->Offsets(), m_aOffsets, pSnap->OffsetSize());
|
||||||
mem_copy(pSnap->DataStart(), m_aData, m_DataSize);
|
mem_copy(pSnap->DataStart(), m_aData, m_DataSize);
|
||||||
return sizeof(CSnapshot) + OffsetSize + m_DataSize;
|
return pSnap->TotalSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSnapshotBuilder::GetTypeFromIndex(int Index)
|
int CSnapshotBuilder::GetTypeFromIndex(int Index)
|
||||||
|
|
Loading…
Reference in a new issue