Add: Setting to save a unique id for each savegame

This commit is contained in:
damfr
2018-11-19 16:03:52 +01:00
parent 868c6f924a
commit 5f6858c379
5 changed files with 23 additions and 1 deletions

View File

@@ -3045,6 +3045,12 @@ bool AfterLoadGame()
}
}
if (IsSavegameVersionBefore(203)) {
/* 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] */
}
/* Station acceptance is some kind of cache */
if (IsSavegameVersionBefore(127)) {
Station *st;

View File

@@ -270,8 +270,9 @@
* 200 #6805 Extend railtypes to 64, adding uint16 to map array.
* 201 #6885 Extend NewGRF persistant storages.
* 202 #6867 Increase industry cargo slots to 16 in, 16 out
* 203 #6973 Add unique id to savegames
*/
extern const uint16 SAVEGAME_VERSION = 202; ///< Current savegame version of OpenTTD.
extern const uint16 SAVEGAME_VERSION = 203; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading
FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop.