diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-06 23:23:12 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-15 16:45:04 +0200 |
commit | a146bcfe93a6c913781cfe471166359e744195d7 (patch) | |
tree | 1c4d5065705dfe540620ca974214bf36664a5361 /src/saveload/saveload.h | |
parent | d0bcb9839a9080326ade985e4b109752fd88e2a6 (diff) | |
download | openttd-a146bcfe93a6c913781cfe471166359e744195d7.tar.xz |
Change: store length of SL_STRUCTLIST in the savegame
This wasn't consistently done, and often variables were used that
were read by an earlier blob. By moving it next to the struct
itself, the code becomes a bit more self-contained and easier to
read.
Additionally, this allows for external tooling to know how many
structs to expect, instead of having to know where to find the
length-field or a hard-coded value that can change at any moment.
Diffstat (limited to 'src/saveload/saveload.h')
-rw-r--r-- | src/saveload/saveload.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 7b0127709..42d14c785 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -326,9 +326,11 @@ enum SaveLoadVersion : uint16 { 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. + SLV_MAPGEN_SETTINGS_REVAMP, ///< 290 PR#8891 v1.11 Revamp of some mapgen settings (snow coverage, desert coverage, heightmap height, custom terrain type). SLV_GROUP_REPLACE_WAGON_REMOVAL, ///< 291 PR#7441 Per-group wagon removal flag. SLV_CUSTOM_SUBSIDY_DURATION, ///< 292 PR#9081 Configurable subsidy duration. + SLV_SAVELOAD_LIST_LENGTH, ///< 293 PR#9374 Consistency in list length with SL_STRUCT / SL_STRUCTLIST / SL_DEQUE / SL_REFLIST. SL_MAX_VERSION, ///< Highest possible saveload version }; @@ -992,6 +994,9 @@ void WriteValue(void *ptr, VarType conv, int64 val); void SlSetArrayIndex(uint index); int SlIterateArray(); +void SlSetStructListLength(size_t length); +size_t SlGetStructListLength(size_t limit); + void SlAutolength(AutolengthProc *proc, void *arg); size_t SlGetFieldLength(); void SlSetLength(size_t length); |