Merge remote-tracking branch 'damfr/save-unique-id' into jgrpp

# Conflicts:
#	src/saveload/afterload.cpp
#	src/saveload/saveload.cpp
This commit is contained in:
Jonathan G Rennison
2019-01-22 18:42:01 +00:00
8 changed files with 61 additions and 2 deletions

View File

@@ -3597,6 +3597,12 @@ bool AfterLoadGame()
}
}
if (SlXvIsFeatureMissing(XSLFI_SAVEGAME_UNIQUE_ID)) {
/* Generate a random id for savegames that didn't have one */
/* We keep id 0 for old savegames that don't have an id */
_settings_game.game_creation.generation_unique_id = _interactive_random.Next(UINT32_MAX-1) + 1; /* Generates between [1;UINT32_MAX] */
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();

View File

@@ -93,6 +93,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_BUY_LAND_RATE_LIMIT, XSCF_NULL, 1, 1, "buy_land_rate_limit", NULL, NULL, NULL },
{ XSLFI_DUAL_RAIL_TYPES, XSCF_NULL, 1, 1, "dual_rail_types", NULL, NULL, NULL },
{ XSLFI_CONSIST_SPEED_RD_FLAG, XSCF_NULL, 1, 1, "consist_speed_rd_flag", NULL, NULL, NULL },
{ XSLFI_SAVEGAME_UNIQUE_ID, XSCF_IGNORABLE_ALL, 1, 1, "savegame_unique_id", NULL, NULL, NULL },
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
};

View File

@@ -67,6 +67,7 @@ enum SlXvFeatureIndex {
XSLFI_BUY_LAND_RATE_LIMIT, ///< Buy land rate limit
XSLFI_DUAL_RAIL_TYPES, ///< Two rail-types per tile
XSLFI_CONSIST_SPEED_RD_FLAG, ///< Consist speed reduction flag
XSLFI_SAVEGAME_UNIQUE_ID, ///< Savegame unique ID
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk