Merge branch 'save_ext' into extra_large_maps-sx

This commit is contained in:
Jonathan G Rennison 2015-09-12 14:15:47 +01:00
commit 72dadf7c6b

View File

@ -164,7 +164,6 @@ static void Save_SLXI()
SlXvSetCurrentState(); SlXvSetCurrentState();
static const SaveLoad _xlsi_sub_chunk_desc[] = { static const SaveLoad _xlsi_sub_chunk_desc[] = {
SLE_VAR(SlxiSubChunkInfo, save_version, SLE_UINT16),
SLE_STR(SlxiSubChunkInfo, name, SLE_STR, 0), SLE_STR(SlxiSubChunkInfo, name, SLE_STR, 0),
SLE_END() SLE_END()
}; };
@ -178,9 +177,9 @@ static void Save_SLXI()
chunk_counts.resize(XSLFI_SIZE); chunk_counts.resize(XSLFI_SIZE);
const SlxiSubChunkInfo *info = _sl_xv_sub_chunk_infos; const SlxiSubChunkInfo *info = _sl_xv_sub_chunk_infos;
for (; info->index != XSLFI_NULL; ++info) { for (; info->index != XSLFI_NULL; ++info) {
if (info->save_version > 0) { if (_sl_xv_feature_versions[info->index] > 0) {
item_count++; item_count++;
length += 4; length += 6;
length += SlCalcObjLength(info, _xlsi_sub_chunk_desc); length += SlCalcObjLength(info, _xlsi_sub_chunk_desc);
if (info->save_proc) { if (info->save_proc) {
uint32 extra_data_length = info->save_proc(info, true); uint32 extra_data_length = info->save_proc(info, true);
@ -208,7 +207,8 @@ static void Save_SLXI()
// write data // write data
info = _sl_xv_sub_chunk_infos; info = _sl_xv_sub_chunk_infos;
for (; info->index != XSLFI_NULL; ++info) { for (; info->index != XSLFI_NULL; ++info) {
if (info->save_version > 0) { uint16 save_version = _sl_xv_feature_versions[info->index];
if (save_version > 0) {
SlxiSubChunkFlags flags = info->flags; SlxiSubChunkFlags flags = info->flags;
assert(!(flags & (XSCF_EXTRA_DATA_PRESENT | XSCF_CHUNK_ID_LIST_PRESENT))); assert(!(flags & (XSCF_EXTRA_DATA_PRESENT | XSCF_CHUNK_ID_LIST_PRESENT)));
uint32 extra_data_length = extra_data_lengths[info->index]; uint32 extra_data_length = extra_data_lengths[info->index];
@ -216,6 +216,7 @@ static void Save_SLXI()
if (extra_data_length > 0) flags |= XSCF_EXTRA_DATA_PRESENT; if (extra_data_length > 0) flags |= XSCF_EXTRA_DATA_PRESENT;
if (chunk_count > 0) flags |= XSCF_CHUNK_ID_LIST_PRESENT; if (chunk_count > 0) flags |= XSCF_CHUNK_ID_LIST_PRESENT;
SlWriteUint32(flags); SlWriteUint32(flags);
SlWriteUint16(save_version);
SlObject(const_cast<SlxiSubChunkInfo *>(info), _xlsi_sub_chunk_desc); SlObject(const_cast<SlxiSubChunkInfo *>(info), _xlsi_sub_chunk_desc);
if (extra_data_length > 0) { if (extra_data_length > 0) {