summaryrefslogtreecommitdiff
path: root/src/editor
diff options
context:
space:
mode:
Diffstat (limited to 'src/editor')
-rw-r--r--src/editor/properties.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/editor/properties.h b/src/editor/properties.h
index f3d55b5..34ac765 100644
--- a/src/editor/properties.h
+++ b/src/editor/properties.h
@@ -1,6 +1,7 @@
#pragma once
#include "../gamedef.h"
+#include <concepts>
#if IS_EDITOR
#include <math.h>
@@ -44,6 +45,9 @@ struct EOBJECT {
LIST<struct EDITOR_PROP*> eprops{};
};
+template <typename T>
+concept __eobject_base = __is_base_of(EOBJECT, T);
+
// editor object property
struct EDITOR_PROP {
void* pdata;
@@ -68,16 +72,13 @@ struct EDITOR_PROP {
template <> struct __eprop_type<F32> { static const U8 type = EPROP_F32; };
template <> struct __eprop_type<F64> { static const U8 type = EPROP_F64; };
template <> struct __eprop_type<STR> { static const U8 type = EPROP_STRING; };
- template <> struct __eprop_type<EOBJECT> { static const U8 type = EPROP_OBJ; };
+ template <__eobject_base T> struct __eprop_type<T> { static const U8 type = EPROP_OBJ; };
template <typename LT> struct __eprop_type<LIST<LT>> { static const U8 type = EPROP_LIST; };
template <> struct __eprop_type<LIST<struct MAP_TEXTURE_ENTRY*>> { static const U8 type = EPROP_TEXTURE_LIST; };
};
template <typename T>
const U8 eprop_type() {
- if constexpr( __is_base_of( EOBJECT, T ) )
- return EPROP_OBJ;
-
return EDITOR_PROP::__eprop_type<T>::type;
}
#else