diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 1b813c5960..e20b868204 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -582,7 +582,6 @@ static uint8_t GetSavegameFileType(const SaveLoad &sld) case SL_STDSTR: case SL_ARR: case SL_VECTOR: - case SL_DEQUE: return GetVarFileType(sld.conv) | SLE_FILE_HAS_LENGTH_FIELD; break; case SL_REF: @@ -1510,65 +1509,6 @@ static void SlRefVector(void *vector, VarType conv) SlStorageHelper::SlSaveLoad(vector, conv, SL_REF); } -/** - * Return the size in bytes of a std::deque. - * @param deque The std::deque to find the size of - * @param conv VarType type of variable that is used for calculating the size - * @return The size of this type in bytes. - */ -static inline size_t SlCalcDequeLen(const void *deque, VarType conv) -{ - switch (GetVarMemType(conv)) { - case SLE_VAR_BL: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_I8: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_U8: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_I16: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_U16: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_I32: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_U32: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_I64: return SlStorageHelper::SlCalcLen(deque, conv); - case SLE_VAR_U64: return SlStorageHelper::SlCalcLen(deque, conv); - - case SLE_VAR_STR: - /* Strings are a length-prefixed field type in the savegame table format, - * these may not be directly stored in another length-prefixed container type. */ - NOT_REACHED(); - - default: NOT_REACHED(); - } -} - -/** - * Save/load a std::deque. - * @param deque The std::deque being manipulated - * @param conv VarType type of variable that is used for calculating the size - */ -static void SlDeque(void *deque, VarType conv) -{ - switch (GetVarMemType(conv)) { - case SLE_VAR_BL: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_I8: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_U8: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_I16: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_U16: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_I32: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_U32: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_I64: SlStorageHelper::SlSaveLoad(deque, conv); break; - case SLE_VAR_U64: SlStorageHelper::SlSaveLoad(deque, conv); break; - - case SLE_VAR_STR: - /* Strings are a length-prefixed field type in the savegame table format, - * these may not be directly stored in another length-prefixed container type. - * This is permitted for load-related actions, because invalid fields of this type are present - * from SLV_COMPANY_ALLOW_LIST up to SLV_COMPANY_ALLOW_LIST_V2. */ - assert(_sl.action != SLA_SAVE); - SlStorageHelper::SlSaveLoad(deque, conv, SL_STDSTR); - break; - - default: NOT_REACHED(); - } -} - /** * Return the size in bytes of a std::vector. * @param vector The std::vector to find the size of @@ -1695,7 +1635,6 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld) case SL_ARR: return SlCalcArrayLen(sld.length, sld.conv); case SL_REFLIST: return SlCalcRefListLen(GetVariableAddress(object, sld), sld.conv); case SL_REFVECTOR: return SlCalcRefVectorLen(GetVariableAddress(object, sld), sld.conv); - case SL_DEQUE: return SlCalcDequeLen(GetVariableAddress(object, sld), sld.conv); case SL_VECTOR: return SlCalcVectorLen(GetVariableAddress(object, sld), sld.conv); case SL_STDSTR: return SlCalcStdStringLen(GetVariableAddress(object, sld)); case SL_SAVEBYTE: return 1; // a byte is logically of size 1 @@ -1741,7 +1680,6 @@ static bool SlObjectMember(void *object, const SaveLoad &sld) case SL_ARR: case SL_REFLIST: case SL_REFVECTOR: - case SL_DEQUE: case SL_VECTOR: case SL_STDSTR: { void *ptr = GetVariableAddress(object, sld); @@ -1752,7 +1690,6 @@ static bool SlObjectMember(void *object, const SaveLoad &sld) case SL_ARR: SlArray(ptr, sld.length, conv); break; case SL_REFLIST: SlRefList(ptr, conv); break; case SL_REFVECTOR: SlRefVector(ptr, conv); break; - case SL_DEQUE: SlDeque(ptr, conv); break; case SL_VECTOR: SlVector(ptr, conv); break; case SL_STDSTR: SlStdString(ptr, sld.conv); break; default: NOT_REACHED(); diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 1884528bf2..510c692791 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -741,7 +741,6 @@ enum SaveLoadType : uint8_t { SL_STDSTR = 4, ///< Save/load a \c std::string. SL_ARR = 5, ///< Save/load a fixed-size array of #SL_VAR elements. - SL_DEQUE = 6, ///< Save/load a deque of #SL_VAR elements. SL_VECTOR = 7, ///< Save/load a vector of #SL_VAR elements. SL_REFLIST = 8, ///< Save/load a list of #SL_REF elements. SL_STRUCTLIST = 9, ///< Save/load a list of structs. @@ -855,7 +854,6 @@ inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t leng case SL_REF: return sizeof(void *) == size; case SL_STDSTR: return SlVarSize(type) == size; case SL_ARR: return SlVarSize(type) * length <= size; // Partial load of array is permitted. - case SL_DEQUE: return sizeof(std::deque) == size; case SL_VECTOR: return sizeof(std::vector) == size; case SL_REFLIST: return sizeof(std::list) == size; case SL_REFVECTOR: return sizeof(std::vector) == size; @@ -1014,16 +1012,6 @@ inline constexpr bool SlCheckVarSize(SaveLoadType cmd, VarType type, size_t leng */ #define SLE_CONDVECTOR(base, variable, type, from, to) SLE_GENERAL(SL_VECTOR, base, variable, type, 0, from, to, 0) -/** - * Storage of a deque of #SL_VAR elements in some savegame versions. - * @param base Name of the class or struct containing the list. - * @param variable Name of the variable in the class or struct referenced by \a base. - * @param type Storage of the data in memory and in the savegame. - * @param from First savegame version that has the list. - * @param to Last savegame version that has the list. - */ -#define SLE_CONDDEQUE(base, variable, type, from, to) SLE_GENERAL(SL_DEQUE, base, variable, type, 0, from, to, 0) - /** * Storage of a vector of #SL_VAR elements in some savegame versions. * @param base Name of the class or struct containing the list.