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

Remove logic for serialization of VLC entities

This commit is contained in:
Ivan Savenko 2024-10-12 18:23:45 +00:00
parent 01d787fb5a
commit c4481f3797
2 changed files with 0 additions and 32 deletions

View File

@ -235,25 +235,6 @@ public:
return;
}
loadPointerImpl(data);
}
template < typename T, typename std::enable_if_t < std::is_base_of_v<Entity, std::remove_pointer_t<T>>, int > = 0 >
void loadPointerImpl(T &data)
{
using DataType = std::remove_pointer_t<T>;
typename DataType::IdentifierType index;
load(index);
auto * constEntity = index.toEntity(VLC);
auto * constData = dynamic_cast<const DataType *>(constEntity);
data = const_cast<DataType *>(constData);
}
template < typename T, typename std::enable_if_t < !std::is_base_of_v<Entity, std::remove_pointer_t<T>>, int > = 0 >
void loadPointerImpl(T &data)
{
if(reader->smartVectorMembersSerialization)
{
typedef typename std::remove_const_t<typename std::remove_pointer_t<T>> TObjectType; //eg: const CGHeroInstance * => CGHeroInstance

View File

@ -186,19 +186,6 @@ public:
if(data == nullptr)
return;
savePointerImpl(data);
}
template < typename T, typename std::enable_if_t < std::is_base_of_v<Entity, std::remove_pointer_t<T>>, int > = 0 >
void savePointerImpl(const T &data)
{
auto index = data->getId();
save(index);
}
template < typename T, typename std::enable_if_t < !std::is_base_of_v<Entity, std::remove_pointer_t<T>>, int > = 0 >
void savePointerImpl(const T &data)
{
typedef typename std::remove_const_t<typename std::remove_pointer_t<T>> TObjectType;
if(writer->smartVectorMembersSerialization)