|
|
|
@ -687,6 +687,7 @@ struct SaveLoadCompat {
|
|
|
|
|
/**
|
|
|
|
|
* Storage of simple variables, references (pointers), and arrays.
|
|
|
|
|
* @param cmd Load/save type. @see SaveLoadType
|
|
|
|
|
* @param name Field name for table chunks.
|
|
|
|
|
* @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.
|
|
|
|
@ -695,7 +696,20 @@ struct SaveLoadCompat {
|
|
|
|
|
* @param extra Extra data to pass to the address callback function.
|
|
|
|
|
* @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_NAME(cmd, name, base, variable, type, length, from, to, extra) SaveLoad {name, 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}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Storage of simple variables, references (pointers), and arrays with a custom name.
|
|
|
|
|
* @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.
|
|
|
|
|
* @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) SLE_GENERAL_NAME(cmd, #variable, base, variable, type, length, from, to, extra)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Storage of a variable in some savegame versions.
|
|
|
|
@ -707,6 +721,17 @@ struct SaveLoadCompat {
|
|
|
|
|
*/
|
|
|
|
|
#define SLE_CONDVAR(base, variable, type, from, to) SLE_GENERAL(SL_VAR, base, variable, type, 0, from, to, 0)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 name Field name for table chunks.
|
|
|
|
|
* @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.
|
|
|
|
|
*/
|
|
|
|
|
#define SLE_CONDVARNAME(base, variable, name, type, from, to) SLE_GENERAL_NAME(SL_VAR, name, base, variable, type, 0, from, to, 0)
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Storage of a reference in some savegame versions.
|
|
|
|
|
* @param base Name of the class or struct containing the variable.
|
|
|
|
|