Remove unnecessary checks in CSnapshotBuilder::Init7 function

The client now validates snapshots including their maximum size, so these additional checks for recording snapshots to demos are unnecessary.
This commit is contained in:
Robert Müller 2024-09-19 13:38:11 +02:00
parent ac9c66047c
commit 2426d59ab5

View file

@ -8,17 +8,6 @@ void CSnapshotBuilder::Init7(const CSnapshot *pSnapshot)
// but the snap we are building is a 0.6 snap // but the snap we are building is a 0.6 snap
m_Sixup = false; m_Sixup = false;
if(pSnapshot->m_DataSize + sizeof(CSnapshot) + pSnapshot->m_NumItems * sizeof(int) * 2 > CSnapshot::MAX_SIZE || pSnapshot->m_NumItems > CSnapshot::MAX_ITEMS)
{
// key and offset per item
dbg_assert(m_DataSize + sizeof(CSnapshot) + m_NumItems * sizeof(int) * 2 < CSnapshot::MAX_SIZE, "too much data");
dbg_assert(m_NumItems < CSnapshot::MAX_ITEMS, "too many items");
dbg_msg("sixup", "demo recording failed on invalid snapshot");
m_DataSize = 0;
m_NumItems = 0;
return;
}
m_DataSize = pSnapshot->m_DataSize; m_DataSize = pSnapshot->m_DataSize;
m_NumItems = pSnapshot->m_NumItems; m_NumItems = pSnapshot->m_NumItems;
mem_copy(m_aOffsets, pSnapshot->Offsets(), sizeof(int) * m_NumItems); mem_copy(m_aOffsets, pSnapshot->Offsets(), sizeof(int) * m_NumItems);