summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/saveload/saveload.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 9f3aa7d1d..2d1e6fc78 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -1261,7 +1261,7 @@ public:
const SlStorageT *list = static_cast<const SlStorageT *>(storage);
- int type_size = SlCalcConvFileLen(SLE_FILE_U32); // Size of the length of the list.
+ int type_size = SlGetArrayLength(list->size());
int item_size = SlCalcConvFileLen(cmd == SL_VAR ? conv : (VarType)SLE_FILE_U32);
return list->size() * item_size + type_size;
}
@@ -1290,7 +1290,7 @@ public:
switch (_sl.action) {
case SLA_SAVE:
- SlWriteUint32((uint32)list->size());
+ SlWriteArrayLength(list->size());
for (auto &item : *list) {
SlSaveLoadMember(cmd, &item, conv);
@@ -1301,8 +1301,8 @@ public:
case SLA_LOAD: {
size_t length;
switch (cmd) {
- case SL_VAR: length = SlReadUint32(); break;
- case SL_REF: length = IsSavegameVersionBefore(SLV_69) ? SlReadUint16() : SlReadUint32(); break;
+ case SL_VAR: length = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? SlReadUint32() : SlReadArrayLength(); break;
+ case SL_REF: length = IsSavegameVersionBefore(SLV_69) ? SlReadUint16() : IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? SlReadUint32() : SlReadArrayLength(); break;
default: NOT_REACHED();
}