|
@@ -15,12 +15,14 @@
|
|
|
#include "../strings_type.h"
|
|
|
#include "../core/span_type.hpp"
|
|
|
#include <optional>
|
|
|
#include <string>
|
|
|
#include <vector>
|
|
|
|
|
|
#include "extended_ver_sl.h"
|
|
|
|
|
|
/** SaveLoad versions
|
|
|
* Previous savegame versions, the trunk revision where they were
|
|
|
* introduced and the released version that had that particular
|
|
|
* savegame version.
|
|
|
* Up to savegame version 18 there is a minor version as well.
|
|
|
*
|
|
@@ -320,12 +322,36 @@ enum SaveLoadVersion : uint16 {
|
|
|
* indicate they are loading a savegame from a patchpack.
|
|
|
* For future patchpack creators: please follow a system like JGRPP, where
|
|
|
* the version is masked with 0x8000, and the true version is stored in
|
|
|
* its own chunk with feature toggles.
|
|
|
*/
|
|
|
SLV_START_PATCHPACKS, ///< 220 First known patchpack to use a version just above ours.
|
|
|
|
|
|
// legacy patchpack version codes
|
|
|
SLV_PP1X = 100, ///< 1.x
|
|
|
SLV_PP2X = 126, ///< 2.x
|
|
|
SLV_PP3X = 186, ///< 3.x
|
|
|
SLV_PP4X = 189, ///< 4.20033.004 (conflicting with 5.x, because FGS)
|
|
|
SLV_PP5X_DAYLENGTH = 160, ///< 5.22434.001
|
|
|
SLV_PP5X_HOTFIX_174 = 174, ///< 5.23975.005b
|
|
|
SLV_PP5X_HOTFIX_175 = 175, ///< 5.24187.007
|
|
|
SLV_PP5X_HOTFIX_177 = 177, ///< 5.24771.008b
|
|
|
SLV_PP5X_HOTFIX_187 = 187, ///< 5.25942.009
|
|
|
SLV_PP5X_STATION_NEWGRF = 188, ///< 5.26167.011
|
|
|
SLV_PP5X_INFRASTRUCTURE = 189, ///< 5.26167.012
|
|
|
SLV_PP5X_RUNNING_COST_MULT = 194, ///< 5.27099.013
|
|
|
SLV_PP5X_PLANE_RANGE_MULT = 195, ///< 5.27500.016
|
|
|
SLV_PP5X_HOTFIX_196 = 196, ///< 5.27930.017
|
|
|
SLV_PP5X_EXTRA_EXPENSES = 197, ///< 5.27930.018
|
|
|
SLV_PP5X_HOTFIX_198 = 198, ///< 5.020
|
|
|
SLV_PP5X_IMPROVED_BREAKDOWNS = 217, ///< 5.022 dev
|
|
|
SLV_PP5X_BREAKDOWN_SCALER = 218, ///< 5.022 dev
|
|
|
SLV_PP5X_TOWN_IMPROVEMENTS = 219, ///< 5.022 dev
|
|
|
SLV_PP5X_DILAPIDATION = 220, ///< 5.022 final
|
|
|
SLV_PP5X_HOTFIX_222 = 222, ///< 5.024
|
|
|
|
|
|
SLV_END_PATCHPACKS = 286, ///< 286 Last known patchpack to use a version just above ours.
|
|
|
|
|
|
SLV_GS_INDUSTRY_CONTROL, ///< 287 PR#7912 and PR#8115 GS industry control.
|
|
|
SLV_VEH_MOTION_COUNTER, ///< 288 PR#8591 Desync safe motion counter
|
|
|
SLV_INDUSTRY_TEXT, ///< 289 PR#8576 v1.11.0-RC1 Additional GS text for industries.
|
|
|
|
|
@@ -660,12 +686,13 @@ struct SaveLoad {
|
|
|
SaveLoadVersion version_from; ///< Save/load the variable starting from this savegame version.
|
|
|
SaveLoadVersion version_to; ///< Save/load the variable before this savegame version.
|
|
|
size_t size; ///< The sizeof size.
|
|
|
SaveLoadAddrProc *address_proc; ///< Callback proc the get the actual variable address in memory.
|
|
|
size_t extra_data; ///< Extra data for the callback proc.
|
|
|
std::shared_ptr<SaveLoadHandler> handler; ///< Custom handler for Save/Load procs.
|
|
|
SlXvFeatureTest ext_feature_test; ///< extended feature test
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* SaveLoad information for backwards compatibility.
|
|
|
*
|
|
|
* At SLV_SETTINGS_NAME a new method of keeping track of fields in a savegame
|
|
@@ -675,98 +702,115 @@ struct SaveLoad {
|
|
|
*/
|
|
|
struct SaveLoadCompat {
|
|
|
std::string name; ///< Name of the field.
|
|
|
uint16 length; ///< Length of the NULL field.
|
|
|
SaveLoadVersion version_from; ///< Save/load the variable starting from this savegame version.
|
|
|
SaveLoadVersion version_to; ///< Save/load the variable before this savegame version.
|
|
|
SlXvFeatureTest ext_feature_test; ///< extended feature test
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Storage of simple variables, references (pointers), and arrays.
|
|
|
* @param cmd Load/save type. @see SaveLoadType
|
|
|
* @param base Name of the class or struct containing the variable.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the field.
|
|
|
* @param to Last savegame version that has the field.
|
|
|
* @param extra Extra data to pass to the address callback function.
|
|
|
* @param extver Extended feature test
|
|
|
* @note In general, it is better to use one of the SLE_* macros below.
|
|
|
*/
|
|
|
#define SLE_GENERAL(cmd, base, variable, type, length, from, to, extra) SaveLoad {#variable, cmd, type, length, from, to, cpp_sizeof(base, variable), [] (void *b, size_t) -> void * { assert(b != nullptr); return const_cast<void *>(static_cast<const void *>(std::addressof(static_cast<base *>(b)->variable))); }, extra, nullptr}
|
|
|
#define SLE_GENERAL_X(cmd, base, variable, type, length, from, to, extra, extver) SaveLoad {#variable, cmd, type, length, from, to, cpp_sizeof(base, variable), [] (void *b, size_t) -> void * { assert(b != nullptr); return const_cast<void *>(static_cast<const void *>(std::addressof(static_cast<base *>(b)->variable))); }, extra, nullptr, extver}
|
|
|
#define SLE_GENERAL(cmd, base, variable, type, length, from, to, extra) SLE_GENERAL_X(cmd, base, variable, type, length, from, to, extra, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a variable in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the variable.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the field.
|
|
|
* @param to Last savegame version that has the field.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDVAR(base, variable, type, from, to) SLE_GENERAL(SL_VAR, base, variable, type, 0, from, to, 0)
|
|
|
#define SLE_CONDVAR_X(base, variable, type, from, to, extver) SLE_GENERAL_X(SL_VAR, base, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLE_CONDVAR(base, variable, type, from, to) SLE_CONDVAR_X(base, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a reference in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the variable.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Type of the reference, a value from #SLRefType.
|
|
|
* @param from First savegame version that has the field.
|
|
|
* @param to Last savegame version that has the field.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SL_REF, base, variable, type, 0, from, to, 0)
|
|
|
#define SLE_CONDREF_X(base, variable, type, from, to, extver) SLE_GENERAL_X(SL_REF, base, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLE_CONDREF(base, variable, type, from, to) SLE_CONDREF_X(base, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a fixed-size array of #SL_VAR elements in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the array.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param length Number of elements in the array.
|
|
|
* @param from First savegame version that has the array.
|
|
|
* @param to Last savegame version that has the array.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDARR(base, variable, type, length, from, to) SLE_GENERAL(SL_ARR, base, variable, type, length, from, to, 0)
|
|
|
#define SLE_CONDARR_X(base, variable, type, length, from, to, extver) SLE_GENERAL_X(SL_ARR, base, variable, type, length, from, to, 0, extver)
|
|
|
#define SLE_CONDARR(base, variable, type, length, from, to) SLE_CONDARR_X(base, variable, type, length, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a string in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the string.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param length Number of elements in the string (only used for fixed size buffers).
|
|
|
* @param from First savegame version that has the string.
|
|
|
* @param to Last savegame version that has the string.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDSTR(base, variable, type, length, from, to) SLE_GENERAL(SL_STR, base, variable, type, length, from, to, 0)
|
|
|
#define SLE_CONDSTR_X(base, variable, type, length, from, to, extver) SLE_GENERAL_X(SL_STR, base, variable, type, length, from, to, 0, extver)
|
|
|
#define SLE_CONDSTR(base, variable, type, length, from, to) SLE_CONDSTR_X(base, variable, type, length, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a \c std::string in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the string.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the string.
|
|
|
* @param to Last savegame version that has the string.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDSSTR(base, variable, type, from, to) SLE_GENERAL(SL_STDSTR, base, variable, type, 0, from, to, 0)
|
|
|
#define SLE_CONDSSTR_X(base, variable, type, from, to, extver) SLE_GENERAL_X(SL_STDSTR, base, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLE_CONDSSTR(base, variable, type, from, to) SLE_CONDSSTR_X(base, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a list of #SL_REF elements in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the list.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the list.
|
|
|
* @param to Last savegame version that has the list.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDREFLIST(base, variable, type, from, to) SLE_GENERAL(SL_REFLIST, base, variable, type, 0, from, to, 0)
|
|
|
#define SLE_CONDREFLIST_X(base, variable, type, from, to, extver) SLE_GENERAL_X(SL_REFLIST, base, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLE_CONDREFLIST(base, variable, type, from, to) SLE_CONDREFLIST_X(base, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a deque of #SL_VAR elements in some savegame versions.
|
|
|
* @param base Name of the class or struct containing the list.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the list.
|
|
|
* @param to Last savegame version that has the list.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLE_CONDDEQUE(base, variable, type, from, to) SLE_GENERAL(SL_DEQUE, base, variable, type, 0, from, to, 0)
|
|
|
#define SLE_CONDDEQUE_X(base, variable, type, from, to, extver) SLE_GENERAL_X(SL_DEQUE, base, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLE_CONDDEQUE(base, variable, type, from, to) SLE_CONDDEQUE_X(base, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a variable in every version of a savegame.
|
|
|
* @param base Name of the class or struct containing the variable.
|
|
|
* @param variable Name of the variable in the class or struct referenced by \a base.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
@@ -834,104 +878,124 @@ struct SaveLoadCompat {
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the field.
|
|
|
* @param to Last savegame version that has the field.
|
|
|
* @param extra Extra data to pass to the address callback function.
|
|
|
* @note In general, it is better to use one of the SLEG_* macros below.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_GENERAL(name, cmd, variable, type, length, from, to, extra) SaveLoad {name, cmd, type, length, from, to, sizeof(variable), [] (void *, size_t) -> void * { return static_cast<void *>(std::addressof(variable)); }, extra, nullptr}
|
|
|
#define SLEG_GENERAL_X(name, cmd, variable, type, length, from, to, extra, extver) SaveLoad {name, cmd, type, length, from, to, sizeof(variable), [] (void *, size_t) -> void * { return static_cast<void *>(std::addressof(variable)); }, extra, nullptr, extver}
|
|
|
#define SLEG_GENERAL(name, cmd, variable, type, length, from, to, extra) SLEG_GENERAL_X(name, cmd, variable, type, length, from, to, extra, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global variable in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the field.
|
|
|
* @param to Last savegame version that has the field.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDVAR(name, variable, type, from, to) SLEG_GENERAL(name, SL_VAR, variable, type, 0, from, to, 0)
|
|
|
#define SLEG_CONDVAR_X(name, variable, type, from, to, extver) SLEG_GENERAL_X(name, SL_VAR, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLEG_CONDVAR(name, variable, type, from, to) SLEG_CONDVAR_X(name, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global reference in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the field.
|
|
|
* @param to Last savegame version that has the field.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDREF(name, variable, type, from, to) SLEG_GENERAL(name, SL_REF, variable, type, 0, from, to, 0)
|
|
|
#define SLEG_CONDREF_X(name, variable, type, from, to, extver) SLEG_GENERAL_X(name, SL_REF, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLEG_CONDREF(name, variable, type, from, to) SLEG_CONDREF_X(name, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global fixed-size array of #SL_VAR elements in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param length Number of elements in the array.
|
|
|
* @param from First savegame version that has the array.
|
|
|
* @param to Last savegame version that has the array.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDARR(name, variable, type, length, from, to) SLEG_GENERAL(name, SL_ARR, variable, type, length, from, to, 0)
|
|
|
#define SLEG_CONDARR_X(name, variable, type, length, from, to, extver) SLEG_GENERAL_X(name, SL_ARR, variable, type, length, from, to, 0, extver)
|
|
|
#define SLEG_CONDARR(name, variable, type, length, from, to) SLEG_CONDARR_X(name, variable, type, length, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global string in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param length Number of elements in the string (only used for fixed size buffers).
|
|
|
* @param from First savegame version that has the string.
|
|
|
* @param to Last savegame version that has the string.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDSTR(name, variable, type, length, from, to) SLEG_GENERAL(name, SL_STR, variable, type, length, from, to, 0)
|
|
|
#define SLEG_CONDSTR_X(name, variable, type, length, from, to, extver) SLEG_GENERAL_X(name, SL_STR, variable, type, length, from, to, 0, extver)
|
|
|
#define SLEG_CONDSTR(name, variable, type, length, from, to) SLEG_CONDSTR_X(name, variable, type, length, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global \c std::string in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the string.
|
|
|
* @param to Last savegame version that has the string.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDSSTR(name, variable, type, from, to) SLEG_GENERAL(name, SL_STDSTR, variable, type, 0, from, to, 0)
|
|
|
#define SLEG_CONDSSTR_X(name, variable, type, from, to, extver) SLEG_GENERAL_X(name, SL_STDSTR, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLEG_CONDSSTR(name, variable, type, from, to) SLEG_CONDSSTR_X(name, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a structs in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param handler SaveLoadHandler for the structs.
|
|
|
* @param from First savegame version that has the struct.
|
|
|
* @param to Last savegame version that has the struct.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDSTRUCT(name, handler, from, to) SaveLoad {name, SL_STRUCT, 0, 0, from, to, 0, nullptr, 0, std::make_shared<handler>()}
|
|
|
#define SLEG_CONDSTRUCT_X(name, handler, from, to, extver) SaveLoad {name, SL_STRUCT, 0, 0, from, to, 0, nullptr, 0, std::make_shared<handler>(), extver}
|
|
|
#define SLEG_CONDSTRUCT(name, handler, from, to) SLEG_CONDSTRUCT_X(name, handler, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global reference list in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the list.
|
|
|
* @param to Last savegame version that has the list.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDREFLIST(name, variable, type, from, to) SLEG_GENERAL(name, SL_REFLIST, variable, type, 0, from, to, 0)
|
|
|
#define SLEG_CONDREFLIST_X(name, variable, type, from, to, extver) SLEG_GENERAL_X(name, SL_REFLIST, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLEG_CONDREFLIST(name, variable, type, from, to) SLEG_CONDREFLIST_X(name, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global vector of #SL_VAR elements in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
|
* @param from First savegame version that has the list.
|
|
|
* @param to Last savegame version that has the list.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDVECTOR(name, variable, type, from, to) SLEG_GENERAL(name, SL_VECTOR, variable, type, 0, from, to, 0)
|
|
|
#define SLEG_CONDVECTOR_X(name, variable, type, from, to, extver) SLEG_GENERAL_X(name, SL_VECTOR, variable, type, 0, from, to, 0, extver)
|
|
|
#define SLEG_CONDVECTOR(name, variable, type, from, to) SLEG_CONDVECTOR_X(name, variable, type, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a list of structs in some savegame versions.
|
|
|
* @param name The name of the field.
|
|
|
* @param handler SaveLoadHandler for the list of structs.
|
|
|
* @param from First savegame version that has the list.
|
|
|
* @param to Last savegame version that has the list.
|
|
|
* @param extver Extended feature test
|
|
|
*/
|
|
|
#define SLEG_CONDSTRUCTLIST(name, handler, from, to) SaveLoad {name, SL_STRUCTLIST, 0, 0, from, to, 0, nullptr, 0, std::make_shared<handler>()}
|
|
|
#define SLEG_CONDSTRUCTLIST_X(name, handler, from, to, extver) SaveLoad {name, SL_STRUCTLIST, 0, 0, from, to, 0, nullptr, 0, std::make_shared<handler>(), extver}
|
|
|
#define SLEG_CONDSTRUCTLIST(name, handler, from, to) SLEG_CONDSTRUCTLIST_X(name, handler, from, to, SlXvFeatureTest())
|
|
|
|
|
|
/**
|
|
|
* Storage of a global variable in every savegame version.
|
|
|
* @param name The name of the field.
|
|
|
* @param variable Name of the global variable.
|
|
|
* @param type Storage of the data in memory and in the savegame.
|
|
@@ -1001,24 +1065,26 @@ struct SaveLoadCompat {
|
|
|
#define SLEG_STRUCTLIST(name, handler) SLEG_CONDSTRUCTLIST(name, handler, SL_MIN_VERSION, SL_MAX_VERSION)
|
|
|
|
|
|
/**
|
|
|
* Field name where the real SaveLoad can be located.
|
|
|
* @param name The name of the field.
|
|
|
*/
|
|
|
#define SLC_VAR(name) {name, 0, SL_MIN_VERSION, SL_MAX_VERSION}
|
|
|
#define SLC_VAR_X(name, extver) {name, 0, SL_MIN_VERSION, SL_MAX_VERSION, extver}
|
|
|
#define SLC_VAR(name) {name, 0, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest()}
|
|
|
|
|
|
/**
|
|
|
* Empty space in every savegame version.
|
|
|
* @param length Length of the empty space.
|
|
|
* @param from First savegame version that has the empty space.
|
|
|
* @param to Last savegame version that has the empty space.
|
|
|
*/
|
|
|
#define SLC_NULL(length, from, to) {{}, length, from, to}
|
|
|
#define SLC_NULL_X(length, from, to, extver) {{}, length, from, to, extver}
|
|
|
#define SLC_NULL(length, from, to) {{}, length, from, to, SlXvFeatureTest()}
|
|
|
|
|
|
/** End marker of compat variables save or load. */
|
|
|
#define SLC_END() {{}, 0, SL_MIN_VERSION, SL_MIN_VERSION}
|
|
|
#define SLC_END() {{}, 0, SL_MIN_VERSION, SL_MIN_VERSION, SlXvFeatureTest()}
|
|
|
|
|
|
/**
|
|
|
* Checks whether the savegame is below \a major.\a minor.
|
|
|
* @param major Major number of the version to check against.
|
|
|
* @param minor Minor number of the version to check against. If \a minor is 0 or not specified, only the major number is checked.
|
|
|
* @return Savegame version is earlier than the specified version.
|
|
@@ -1121,12 +1187,23 @@ void SlSetLength(size_t length);
|
|
|
size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld);
|
|
|
size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt);
|
|
|
|
|
|
byte SlReadByte();
|
|
|
void SlWriteByte(byte b);
|
|
|
|
|
|
int SlReadUint16();
|
|
|
uint32 SlReadUint32();
|
|
|
uint64 SlReadUint64();
|
|
|
|
|
|
void SlWriteUint16(uint16 v);
|
|
|
void SlWriteUint32(uint32 v);
|
|
|
void SlWriteUint64(uint64 v);
|
|
|
|
|
|
size_t SlGetBytesRead();
|
|
|
size_t SlGetBytesWritten();
|
|
|
|
|
|
void SlGlobList(const SaveLoadTable &slt);
|
|
|
void SlCopy(void *object, size_t length, VarType conv);
|
|
|
std::vector<SaveLoad> SlTableHeader(const SaveLoadTable &slt);
|
|
|
std::vector<SaveLoad> SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct);
|
|
|
void SlObject(void *object, const SaveLoadTable &slt);
|
|
|
void NORETURN SlError(StringID string, const char *extra_msg = nullptr);
|