Add extended feature array with static current version values

pull/374/head
Jonathan G Rennison 2 years ago
parent bffff8e357
commit dacdb1137a

@ -680,6 +680,7 @@ int openttd_main(int argc, char *argv[])
{
SetSelfAsMainThread();
PerThreadSetup();
SlXvSetStaticCurrentVersions();
std::string musicdriver;
std::string sounddriver;
std::string videodriver;

@ -52,6 +52,7 @@
#include "../safeguards.h"
uint16 _sl_xv_feature_versions[XSLFI_SIZE]; ///< array of all known feature types and their current versions
uint16 _sl_xv_feature_static_versions[XSLFI_SIZE]; ///< array of all known feature types and their static current version versions
bool _sl_is_ext_version; ///< is this an extended savegame version, with more info in the SLXI chunk?
bool _sl_is_faked_ext; ///< is this a faked extended savegame version, with no SLXI chunk? See: SlXvCheckSpecialSavegameVersions.
bool _sl_maybe_springpp; ///< is this possibly a SpringPP savegame?
@ -259,6 +260,19 @@ void SlXvSetCurrentState()
}
}
/**
* Set all extended feature versions in the current static version array to their currently enabled versions, i.e. versions suitable for saving
*/
void SlXvSetStaticCurrentVersions()
{
memset(_sl_xv_feature_static_versions, 0, sizeof(_sl_xv_feature_static_versions));
const SlxiSubChunkInfo *info = _sl_xv_sub_chunk_infos;
for (; info->index != XSLFI_NULL; ++info) {
_sl_xv_feature_static_versions[info->index] = info->save_version;
}
}
/**
* Check for "special" savegame versions (i.e. known patchpacks) and set correct savegame version, settings, etc.
*/

@ -140,6 +140,7 @@ enum SlXvFeatureIndex {
};
extern uint16 _sl_xv_feature_versions[XSLFI_SIZE];
extern uint16 _sl_xv_feature_static_versions[XSLFI_SIZE];
/**
* Operator to use when combining traditional savegame number test with an extended feature version test
@ -240,6 +241,7 @@ struct SlxiSubChunkInfo {
void SlXvResetState();
void SlXvSetCurrentState();
void SlXvSetStaticCurrentVersions();
bool SlXvCheckSpecialSavegameVersions();

Loading…
Cancel
Save