ESerializationVersion.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * ESerializationVersion.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. /// This enumeration controls save compatibility support.
  12. /// - 'MINIMAL' represents the oldest supported version counter. A saved game can be loaded if its version is at least 'MINIMAL'.
  13. /// - 'CURRENT' represents the current save version. Saved games are created using the 'CURRENT' version.
  14. ///
  15. /// To make a save-breaking change:
  16. /// - change 'MINIMAL' to a value higher than 'CURRENT'
  17. /// - remove all keys in enumeration between 'MINIMAL' and 'CURRENT' as well as all their usage (will be detected by compiler)
  18. /// - change 'CURRENT' to 'CURRENT = MINIMAL'
  19. ///
  20. /// To make a non-breaking change:
  21. /// - add new enumeration value before 'CURRENT'
  22. /// - change 'CURRENT' to 'CURRENT = NEW_TEST_KEY'.
  23. ///
  24. /// To check for version in serialize() call use form
  25. /// if (h.version >= Handler::Version::NEW_TEST_KEY)
  26. /// h & newKey; // loading/saving save of a new version
  27. /// else
  28. /// newKey = saneDefaultValue; // loading of old save
  29. enum class ESerializationVersion : int32_t
  30. {
  31. NONE = 0,
  32. RELEASE_160 = 873,
  33. MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list
  34. NO_RAW_POINTERS_IN_SERIALIZER, // large rework that removed all non-owning pointers from serializer
  35. CURRENT = NO_RAW_POINTERS_IN_SERIALIZER,
  36. MINIMAL = CURRENT,
  37. };
  38. static_assert(ESerializationVersion::MINIMAL <= ESerializationVersion::CURRENT, "Invalid serialization version definition!");