diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-15 11:59:38 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-15 16:45:04 +0200 |
commit | d5cda58158726b80ff619d0ba691420469f18e90 (patch) | |
tree | 48a6df0b2b08881f22b99ea3c624824493180c6d /src/saveload/saveload.h | |
parent | 0d2e3437e3317a5bc7f9a806e76a89091d2cb6d3 (diff) | |
download | openttd-d5cda58158726b80ff619d0ba691420469f18e90.tar.xz |
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.
Diffstat (limited to 'src/saveload/saveload.h')
-rw-r--r-- | src/saveload/saveload.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 42d14c785..c63740ae0 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -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. |