diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-04 09:31:28 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-06 21:45:01 +0200 |
commit | 264991dfa506c0bdebb2e2c936f79a2412dad442 (patch) | |
tree | a84bfa41e32419866ced4478e30cd83a69a75b5f /src/saveload | |
parent | 414e12d26be88043000aa7fe540edc974244dcc8 (diff) | |
download | openttd-264991dfa506c0bdebb2e2c936f79a2412dad442.tar.xz |
Codechange: move SLF_NO_NETWORK_SYNC into settings
It is a settings-only flag, so don't pollute SaveLoad code with it.
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/saveload.cpp | 18 | ||||
-rw-r--r-- | src/saveload/saveload.h | 1 |
2 files changed, 2 insertions, 17 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 427a19aa9..35a6437e1 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -584,7 +584,7 @@ static inline uint SlGetArrayLength(size_t length) * @param conv VarType type of variable that is used for calculating the size * @return Return the size of this type in bytes */ -static inline uint SlCalcConvMemLen(VarType conv) +uint SlCalcConvMemLen(VarType conv) { static const byte conv_mem_size[] = {1, 1, 1, 2, 2, 4, 4, 8, 8, 0}; byte length = GB(conv, 4, 4); @@ -1412,21 +1412,6 @@ static inline bool SlIsObjectValidInSavegame(const SaveLoad &sld) } /** - * Are we going to load this variable when loading a savegame or not? - * @note If the variable is skipped it is skipped in the savegame - * bytestream itself as well, so there is no need to skip it somewhere else - */ -static inline bool SlSkipVariableOnLoad(const SaveLoad &sld) -{ - if ((sld.conv & SLF_NO_NETWORK_SYNC) && _sl.action != SLA_SAVE && _networking && !_network_server) { - SlSkipBytes(SlCalcConvMemLen(sld.conv) * sld.length); - return true; - } - - return false; -} - -/** * Calculate the size of an object. * @param object to be measured. * @param slt The SaveLoad table with objects to save/load. @@ -1538,7 +1523,6 @@ bool SlObjectMember(void *ptr, const SaveLoad &sld) case SL_STDSTR: /* CONDITIONAL saveload types depend on the savegame version */ if (!SlIsObjectValidInSavegame(sld)) return false; - if (SlSkipVariableOnLoad(sld)) return false; switch (sld.cmd) { case SL_VAR: SlSaveLoadConv(ptr, conv); break; diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index ce597affc..c178c4731 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -896,6 +896,7 @@ void WriteValue(void *ptr, VarType conv, int64 val); void SlSetArrayIndex(uint index); int SlIterateArray(); +uint SlCalcConvMemLen(VarType conv); void SlAutolength(AutolengthProc *proc, void *arg); size_t SlGetFieldLength(); void SlSetLength(size_t length); |