Initial implementation of SLXI chunk save/load

This commit is contained in:
Jonathan G Rennison
2015-08-01 12:24:45 +01:00
parent a3980dc6ba
commit bde094fe01
4 changed files with 299 additions and 35 deletions

View File

@@ -274,10 +274,11 @@ SavegameType _savegame_type; ///< type of savegame we are loading
uint32 _ttdp_version; ///< version of TTDP savegame (if applicable)
uint16 _sl_version; ///< the major savegame version identifier
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
bool _sl_is_ext_version; ///< is this an extended savegame version, with more info in the SLXI chunk?
char _savegame_format[8]; ///< how to compress savegames
bool _do_autosave; ///< are we doing an autosave at the moment?
extern bool _sl_is_ext_version;
/** What are we currently doing? */
enum SaveLoadAction {
SLA_LOAD, ///< loading
@@ -419,7 +420,7 @@ struct SaveLoadParams {
static SaveLoadParams _sl; ///< Parameters used for/at saveload.
/* these define the chunks */
//extern const ChunkHandler _version_ext_chunk_handlers[];
extern const ChunkHandler _version_ext_chunk_handlers[];
extern const ChunkHandler _gamelog_chunk_handlers[];
extern const ChunkHandler _map_chunk_handlers[];
extern const ChunkHandler _misc_chunk_handlers[];
@@ -456,7 +457,7 @@ extern const ChunkHandler _persistent_storage_chunk_handlers[];
/** Array of all chunks in a savegame, \c NULL terminated. */
static const ChunkHandler * const _chunk_handlers[] = {
// _version_ext_chunk_handlers, // this should be first, such that it is saved first, as when loading it affects the loading of subsequent chunks
_version_ext_chunk_handlers, // this should be first, such that it is saved first, as when loading it affects the loading of subsequent chunks
_gamelog_chunk_handlers,
_map_chunk_handlers,
_misc_chunk_handlers,
@@ -2662,7 +2663,6 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
_sl.lf->Reset();
_sl_version = 0;
_sl_minor_version = 0;
_sl_is_ext_version = false;
SlXvResetState();
/* Try to find the LZO savegame format; it uses 'OTTD' as tag. */
@@ -2830,7 +2830,6 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
if (!LoadOldSaveGame(filename)) return SL_REINIT;
_sl_version = 0;
_sl_minor_version = 0;
_sl_is_ext_version = false;
SlXvResetState();
GamelogStartAction(GLAT_LOAD);
if (!AfterLoadGame()) {