瀏覽代碼

Minor code cleanup

Ivan Savenko 1 年之前
父節點
當前提交
9f3655c41b

+ 1 - 1
cmake_modules/VCMI_lib.cmake

@@ -557,7 +557,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/serializer/JsonSerializer.h
 		${MAIN_LIB_DIR}/serializer/JsonUpdater.h
 		${MAIN_LIB_DIR}/serializer/Cast.h
-		${MAIN_LIB_DIR}/serializer/SerializerVersion.h
+		${MAIN_LIB_DIR}/serializer/ESerializationVersion.h
 
 		${MAIN_LIB_DIR}/spells/AbilityCaster.h
 		${MAIN_LIB_DIR}/spells/AdventureSpellMechanics.h

+ 1 - 1
lib/serializer/BinaryDeserializer.h

@@ -11,7 +11,7 @@
 
 #include "CSerializer.h"
 #include "CTypeList.h"
-#include "SerializerVersion.h"
+#include "ESerializationVersion.h"
 #include "../mapObjects/CGHeroInstance.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 1 - 1
lib/serializer/BinarySerializer.h

@@ -11,7 +11,7 @@
 
 #include "CSerializer.h"
 #include "CTypeList.h"
-#include "SerializerVersion.h"
+#include "ESerializationVersion.h"
 #include "../mapObjects/CArmedInstance.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 0 - 1
lib/serializer/CLoadFile.h

@@ -10,7 +10,6 @@
 #pragma once
 
 #include "BinaryDeserializer.h"
-#include "SerializerVersion.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 

+ 2 - 2
lib/serializer/CSerializer.h

@@ -136,9 +136,9 @@ struct is_serializeable
 	using No = char (&)[2];
 
 	template<class U>
-	static Yes test(U * data, S* arg1 = 0, typename std::enable_if_t<std::is_void_v<decltype(data->serialize(*arg1))>> * = 0);
+	static Yes test(U * data, S* arg1 = nullptr, typename std::enable_if_t<std::is_void_v<decltype(data->serialize(*arg1))>> * = nullptr);
 	static No test(...);
-	static const bool value = sizeof(Yes) == sizeof(is_serializeable::test((typename std::remove_reference<typename std::remove_cv<T>::type>::type*)0));
+	static const bool value = sizeof(Yes) == sizeof(is_serializeable::test((typename std::remove_reference<typename std::remove_cv<T>::type>::type*)nullptr));
 };
 
 template <typename T> //metafunction returning CGObjectInstance if T is its derivate or T elsewise

+ 9 - 9
lib/serializer/SerializerVersion.h → lib/serializer/ESerializationVersion.h

@@ -9,18 +9,18 @@
  */
 #pragma once
 
-/// This is enumeration that controls save compatibility support
-/// - 'MINIMAL' represents older supported version counter. Save can be loaded if its version is at least 'MINIMAL'
-/// - 'CURRENT' represent current save version. All saves are created using 'CURRENT' version
+/// This enumeration controls save compatibility support.
+/// - 'MINIMAL' represents the oldest supported version counter. A saved game can be loaded if its version is at least 'MINIMAL'.
+/// - 'CURRENT' represents the current save version. Saved games are created using the 'CURRENT' version.
 ///
-/// To add save-breaking change:
-/// - change 'MINIMAL' to value higher than CURRENT
-/// - remove all version enumerations inbetween
+/// To make a save-breaking change:
+/// - change 'MINIMAL' to a value higher than 'CURRENT'
+/// - remove all keys in enumeration between 'MINIMAL' and 'CURRENT' as well as all their usage (will be detected by compiler)
 /// - change 'CURRENT' to 'CURRENT = MINIMAL'
 ///
-/// To add non-breaking change:
+/// To make a non-breaking change:
 /// - add new enumeration value before 'CURRENT'
-/// - change 'CURRENT' to 'CURRENT = NEW_TEST_KEY'
+/// - change 'CURRENT' to 'CURRENT = NEW_TEST_KEY'.
 ///
 /// To check for version in serialize() call use form
 /// if (h.version >= Handler::Version::NEW_TEST_KEY)
@@ -32,7 +32,7 @@ enum class ESerializationVersion : int32_t
 	NONE = 0,
 
 	MINIMAL = 831,
-	RELEASE_143, // 832 + text container in campaigns, +starting hero in RMG options
+	RELEASE_143, // 832 +text container in campaigns, +starting hero in RMG options
 	HAS_EXTRA_OPTIONS, // 833 +extra options struct as part of startinfo
 
 	CURRENT = HAS_EXTRA_OPTIONS