1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Minor code cleanup

This commit is contained in:
Ivan Savenko 2024-01-20 23:26:04 +02:00
parent 0c07384293
commit 9f3655c41b
6 changed files with 14 additions and 15 deletions

View File

@ -557,7 +557,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/serializer/JsonSerializer.h ${MAIN_LIB_DIR}/serializer/JsonSerializer.h
${MAIN_LIB_DIR}/serializer/JsonUpdater.h ${MAIN_LIB_DIR}/serializer/JsonUpdater.h
${MAIN_LIB_DIR}/serializer/Cast.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/AbilityCaster.h
${MAIN_LIB_DIR}/spells/AdventureSpellMechanics.h ${MAIN_LIB_DIR}/spells/AdventureSpellMechanics.h

View File

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

View File

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

View File

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

View File

@ -136,9 +136,9 @@ struct is_serializeable
using No = char (&)[2]; using No = char (&)[2];
template<class U> 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 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 template <typename T> //metafunction returning CGObjectInstance if T is its derivate or T elsewise

View File

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