|
|
@ -33,6 +33,7 @@
|
|
|
|
#include "saveload.h"
|
|
|
|
#include "saveload.h"
|
|
|
|
#include "extended_ver_sl.h"
|
|
|
|
#include "extended_ver_sl.h"
|
|
|
|
#include "../timetable.h"
|
|
|
|
#include "../timetable.h"
|
|
|
|
|
|
|
|
#include "../map_func.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
@ -62,6 +63,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
|
|
|
{ XSLFI_VARIABLE_DAY_LENGTH, XSCF_NULL, 1, 1, "variable_day_length", NULL, NULL, NULL },
|
|
|
|
{ XSLFI_VARIABLE_DAY_LENGTH, XSCF_NULL, 1, 1, "variable_day_length", NULL, NULL, NULL },
|
|
|
|
{ XSLFI_ORDER_OCCUPANCY, XSCF_NULL, 1, 1, "order_occupancy", NULL, NULL, NULL },
|
|
|
|
{ XSLFI_ORDER_OCCUPANCY, XSCF_NULL, 1, 1, "order_occupancy", NULL, NULL, NULL },
|
|
|
|
{ XSLFI_MORE_COND_ORDERS, XSCF_NULL, 1, 1, "more_cond_orders", NULL, NULL, NULL },
|
|
|
|
{ XSLFI_MORE_COND_ORDERS, XSCF_NULL, 1, 1, "more_cond_orders", NULL, NULL, NULL },
|
|
|
|
|
|
|
|
{ XSLFI_EXTRA_LARGE_MAP, XSCF_NULL, 0, 1, "extra_large_map", NULL, NULL, NULL },
|
|
|
|
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
|
|
|
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -125,6 +127,9 @@ void SlXvSetCurrentState()
|
|
|
|
for (; info->index != XSLFI_NULL; ++info) {
|
|
|
|
for (; info->index != XSLFI_NULL; ++info) {
|
|
|
|
_sl_xv_feature_versions[info->index] = info->save_version;
|
|
|
|
_sl_xv_feature_versions[info->index] = info->save_version;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MapSizeX() > 8192 || MapSizeY() > 8192) {
|
|
|
|
|
|
|
|
_sl_xv_feature_versions[XSLFI_EXTRA_LARGE_MAP] = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -220,7 +225,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()
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -234,9 +238,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);
|
|
|
@ -264,7 +268,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];
|
|
|
@ -272,6 +277,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) {
|
|
|
|