From 2426d59ab5302841d277a5a997357296c95eb52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 19 Sep 2024 13:38:11 +0200 Subject: [PATCH] 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. --- src/engine/shared/sixup_translate_snapshot.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/engine/shared/sixup_translate_snapshot.cpp b/src/engine/shared/sixup_translate_snapshot.cpp index f693b45c8..2b06e5369 100644 --- a/src/engine/shared/sixup_translate_snapshot.cpp +++ b/src/engine/shared/sixup_translate_snapshot.cpp @@ -8,17 +8,6 @@ void CSnapshotBuilder::Init7(const CSnapshot *pSnapshot) // but the snap we are building is a 0.6 snap 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_NumItems = pSnapshot->m_NumItems; mem_copy(m_aOffsets, pSnapshot->Offsets(), sizeof(int) * m_NumItems);