Add an extended version feature for map sizes > 8kx8k.

This is to prevent earlier versions from trying to load the savegame
and aborting.
This commit is contained in:
Jonathan G Rennison
2015-09-12 14:17:37 +01:00
parent 72dadf7c6b
commit 421b9034e2
2 changed files with 6 additions and 0 deletions

View File

@@ -32,6 +32,7 @@
#include "../debug.h" #include "../debug.h"
#include "saveload.h" #include "saveload.h"
#include "extended_ver_sl.h" #include "extended_ver_sl.h"
#include "../map_func.h"
#include <vector> #include <vector>
@@ -45,6 +46,7 @@ std::vector<uint32> _sl_xv_discardable_chunk_ids; ///< list of chunks
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_EXTRA_LARGE_MAP, XSCF_NULL, 0, 1, "extra_large_map", NULL, NULL, NULL },
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker { XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
}; };
@@ -108,6 +110,9 @@ void SlXvSetCurrentState()
for (; info->index != XSLFI_NULL; ++info) { for (; info->index != XSLFI_NULL; ++info) {
_sl_xv_feature_versions[info->index] = info->save_version; _sl_xv_feature_versions[info->index] = info->save_version;
} }
if (MapSizeX() > 8192 || MapSizeY() > 8192) {
_sl_xv_feature_versions[XSLFI_EXTRA_LARGE_MAP] = 1;
}
} }
/** /**

View File

@@ -21,6 +21,7 @@
*/ */
enum SlXvFeatureIndex { enum SlXvFeatureIndex {
XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use
XSLFI_EXTRA_LARGE_MAP, ///< Extra large map
XSLFI_SIZE, ///< Total count of features, including null feature XSLFI_SIZE, ///< Total count of features, including null feature
}; };