ESerializationVersion.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. MINIMAL = 831,
  33. RELEASE_143, // 832 +text container in campaigns, +starting hero in RMG options
  34. HAS_EXTRA_OPTIONS, // 833 +extra options struct as part of startinfo
  35. CURRENT = HAS_EXTRA_OPTIONS
  36. };