ESerializationVersion.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.hasFeature(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. MINIMAL = RELEASE_160,
  34. MAP_HEADER_DISPOSED_HEROES, // map header contains disposed heroes list
  35. NO_RAW_POINTERS_IN_SERIALIZER, // large rework that removed all non-owning pointers from serializer
  36. STACK_INSTANCE_EXPERIENCE_FIX, // stack experience is stored as total, not as average
  37. STACK_INSTANCE_ARMY_FIX, // remove serialization of army that owns stack instance
  38. STORE_UID_COUNTER_IN_CMAP, // fix crash caused by conflicting instanceName after loading game
  39. REWARDABLE_EXTENSIONS, // new functionality for rewardable objects
  40. FLAGGABLE_BONUS_SYSTEM_NODE, // flaggable objects now contain bonus system node
  41. RANDOMIZATION_REWORK, // random rolls logic has been moved to server
  42. CUSTOM_BONUS_ICONS, // support for custom icons in bonuses
  43. SERVER_STATISTICS, // statistics now only saved on server
  44. OPPOSITE_SIDE_LIMITER_OWNER, // opposite side limiter no longer stores owner in itself
  45. CURRENT = OPPOSITE_SIDE_LIMITER_OWNER,
  46. };
  47. static_assert(ESerializationVersion::MINIMAL <= ESerializationVersion::CURRENT, "Invalid serialization version definition!");