Codechange: use SL_NULL if you want to store null-bytes or load to nothing

Using SL_ARR for this gives us a bit of trouble later on, where we
add a length-field to SL_ARR. This of course is not the intention
of SLE_CONDNULL. So better seperate it.
This commit is contained in:
Patric Stout
2021-06-15 11:59:38 +02:00
committed by Patric Stout
parent 0d2e3437e3
commit d5cda58158
2 changed files with 31 additions and 30 deletions

View File

@@ -573,6 +573,7 @@ enum SaveLoadType : byte {
SL_STRUCT = 7, ///< Save/load a struct.
SL_STRUCTLIST = 8, ///< Save/load a list of structs.
SL_SAVEBYTE = 9, ///< Save (but not load) a byte.
SL_NULL = 10, ///< Save null-bytes and load to nowhere.
};
typedef void *SaveLoadAddrProc(void *base, size_t extra);
@@ -737,7 +738,7 @@ struct SaveLoad {
* @param from First savegame version that has the empty space.
* @param to Last savegame version that has the empty space.
*/
#define SLE_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL, length, from, to, 0, nullptr, 0, nullptr}
#define SLE_CONDNULL(length, from, to) {SL_NULL, SLE_FILE_U8 | SLE_VAR_NULL, length, from, to, 0, nullptr, 0, nullptr}
/**
* Only write byte during saving; never read it during loading.
@@ -895,7 +896,7 @@ struct SaveLoad {
* @param from First savegame version that has the empty space.
* @param to Last savegame version that has the empty space.
*/
#define SLEG_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL, length, from, to, 0, nullptr, 0, nullptr}
#define SLEG_CONDNULL(length, from, to) {SL_NULL, SLE_FILE_U8 | SLE_VAR_NULL, length, from, to, 0, nullptr, 0, nullptr}
/**
* Checks whether the savegame is below \a major.\a minor.