diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -715,10 +715,11 @@ struct SaveLoad { * to make that happen. */ struct SaveLoadCompat { - std::string name; ///< Name of the field. - uint16_t length; ///< Length of the NULL field. + std::string name; ///< Name of the field. + VarTypes null_type; ///< The type associated with the NULL field; defaults to SLE_FILE_U8 to just count bytes. + uint16_t null_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. + SaveLoadVersion version_to; ///< Save/load the variable before this savegame version. }; /** @@ -1183,18 +1184,26 @@ inline constexpr bool SlCheckVarSize(Sav * 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(name) {name, SLE_FILE_U8, 0, SL_MIN_VERSION, SL_MAX_VERSION} /** * Empty space in every savegame version. - * @param length Length of the empty space. + * @param length Length of the empty space in bytes. * @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(length, from, to) {{}, SLE_FILE_U8, length, from, to} + +/** + * Empty space in every savegame version that was filled with a string. + * @param length Number of strings in 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_STR(length, from, to) {{}, SLE_FILE_STRING, length, from, to} /** End marker of compat variables save or load. */ -#define SLC_END() {{}, 0, SL_MIN_VERSION, SL_MIN_VERSION} +#define SLC_END() {{}, 0, 0, SL_MIN_VERSION, SL_MIN_VERSION} /** * Checks whether the savegame is below \a major.\a minor.