* Save/load a std::vector. * @param vector The std::vector being manipulated * @param conv VarType type of variable that is used for calculating the size */
| 1584 | * @param conv VarType type of variable that is used for calculating the size |
| 1585 | */ |
| 1586 | static void SlVector(void *vector, VarType conv) |
| 1587 | { |
| 1588 | switch (GetVarMemType(conv)) { |
| 1589 | case SLE_VAR_BL: NOT_REACHED(); // Not supported |
| 1590 | case SLE_VAR_I8: SlStorageHelper<std::vector, int8_t>::SlSaveLoad(vector, conv); break; |
| 1591 | case SLE_VAR_U8: SlStorageHelper<std::vector, uint8_t>::SlSaveLoad(vector, conv); break; |
| 1592 | case SLE_VAR_I16: SlStorageHelper<std::vector, int16_t>::SlSaveLoad(vector, conv); break; |
| 1593 | case SLE_VAR_U16: SlStorageHelper<std::vector, uint16_t>::SlSaveLoad(vector, conv); break; |
| 1594 | case SLE_VAR_I32: SlStorageHelper<std::vector, int32_t>::SlSaveLoad(vector, conv); break; |
| 1595 | case SLE_VAR_U32: SlStorageHelper<std::vector, uint32_t>::SlSaveLoad(vector, conv); break; |
| 1596 | case SLE_VAR_I64: SlStorageHelper<std::vector, int64_t>::SlSaveLoad(vector, conv); break; |
| 1597 | case SLE_VAR_U64: SlStorageHelper<std::vector, uint64_t>::SlSaveLoad(vector, conv); break; |
| 1598 | |
| 1599 | case SLE_VAR_STR: |
| 1600 | /* Strings are a length-prefixed field type in the savegame table format, |
| 1601 | * these may not be directly stored in another length-prefixed container type. |
| 1602 | * This is permitted for load-related actions, because invalid fields of this type are present |
| 1603 | * from SLV_COMPANY_ALLOW_LIST up to SLV_COMPANY_ALLOW_LIST_V2. */ |
| 1604 | assert(_sl.action != SLA_SAVE); |
| 1605 | SlStorageHelper<std::vector, std::string>::SlSaveLoad(vector, conv, SL_STDSTR); |
| 1606 | break; |
| 1607 | |
| 1608 | default: NOT_REACHED(); |
| 1609 | } |
| 1610 | } |
| 1611 | |
| 1612 | /** Are we going to save this object or not? */ |
| 1613 | static inline bool SlIsObjectValidInSavegame(const SaveLoad &sld) |
no test coverage detected