From 10f94fb0dd10796d29fa3d86c0dfd8cc546b7450 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 7 Dec 2023 19:16:33 +0000 Subject: [PATCH] Codechange: Remove runtime variable size assertion. --- src/saveload/saveload.cpp | 46 --------------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 2e1131a778..bcc0dbd1ae 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1513,54 +1513,8 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld) return 0; } -/** - * Check whether the variable size of the variable in the saveload configuration - * matches with the actual variable size. - * @param sld The saveload configuration to test. - */ -[[maybe_unused]] static bool IsVariableSizeRight(const SaveLoad &sld) -{ - if (GetVarMemType(sld.conv) == SLE_VAR_NULL) return true; - - switch (sld.cmd) { - case SL_VAR: - switch (GetVarMemType(sld.conv)) { - case SLE_VAR_BL: - return sld.size == sizeof(bool); - case SLE_VAR_I8: - case SLE_VAR_U8: - return sld.size == sizeof(int8_t); - case SLE_VAR_I16: - case SLE_VAR_U16: - return sld.size == sizeof(int16_t); - case SLE_VAR_I32: - case SLE_VAR_U32: - return sld.size == sizeof(int32_t); - case SLE_VAR_I64: - case SLE_VAR_U64: - return sld.size == sizeof(int64_t); - case SLE_VAR_NAME: - return sld.size == sizeof(std::string); - default: - return sld.size == sizeof(void *); - } - case SL_REF: - /* These should all be pointer sized. */ - return sld.size == sizeof(void *); - - case SL_STDSTR: - /* These should be all pointers to std::string. */ - return sld.size == sizeof(std::string); - - default: - return true; - } -} - static bool SlObjectMember(void *object, const SaveLoad &sld) { - assert(IsVariableSizeRight(sld)); - if (!SlIsObjectValidInSavegame(sld)) return false; VarType conv = GB(sld.conv, 0, 8);