* Handle conversion for references. * @param ptr The object being filled/read. * @param conv VarType type of the current element of the struct. */
| 1326 | * @param conv VarType type of the current element of the struct. |
| 1327 | */ |
| 1328 | void SlSaveLoadRef(void *ptr, VarType conv) |
| 1329 | { |
| 1330 | switch (_sl.action) { |
| 1331 | case SLA_SAVE: |
| 1332 | SlWriteUint32((uint32_t)ReferenceToInt(*(void **)ptr, (SLRefType)conv)); |
| 1333 | break; |
| 1334 | case SLA_LOAD_CHECK: |
| 1335 | case SLA_LOAD: |
| 1336 | *(size_t *)ptr = IsSavegameVersionBefore(SLV_69) ? SlReadUint16() : SlReadUint32(); |
| 1337 | break; |
| 1338 | case SLA_PTRS: |
| 1339 | *(void **)ptr = IntToReference(*(size_t *)ptr, (SLRefType)conv); |
| 1340 | break; |
| 1341 | case SLA_NULL: |
| 1342 | *(void **)ptr = nullptr; |
| 1343 | break; |
| 1344 | default: NOT_REACHED(); |
| 1345 | } |
| 1346 | } |
| 1347 | |
| 1348 | /** |
| 1349 | * Template class to help with list-like types. |
no test coverage detected